Attached File(s)
ma cross histo (mtf +arrows + lines).ex4
34 KB
|
250 downloads
I will code your pivot EAs for no charge 24 replies
I will code your scalping EAs for no charge 163 replies
Oanda MT4 - Indicators and EAs not showing 2 replies
EAs and indicators relating to moutaki... 22 replies
InterbankFX has loaded its MT4 platform with custom EAs, indicators and scripts 1 reply
Disliked{quote} This is very different from your earlier request, but a bit clearer. It is not an easy code, and I don't yet see the value/logic in the method. Will this one you describe be a Sell or a Buy trade, on which bar should the trade be taken, and where should the stoploss be?? Use an actual chart (any symbol and any timeframe will be fine) to describe what you want, and indicate two/three times that the signal occurred (bar2 in your picture does not even meet your description) You can draw one of the signal on the actual-chart, and indicate the...Ignored
QuoteDisliked
- Will this one you describe be a Sell or a Buy trade,
QuoteDisliked
- on which bar should the trade be taken,
QuoteDisliked
- and where should the stoploss be??
QuoteDislikedUse an actual chart (any symbol and any timeframe will be fine) to describe what you want, and indicate two/three times that the signal occurred (bar2 in your picture does not even meet your description)
QuoteDislikedYou can draw one of the signal on the actual-chart, and indicate the time that the other two occurred - This will help me better understand what you are describing and I can use the chart to test the code as it is being developed -- if I see any value in the idea
QuoteDislikedIt is not an easy code, and I don't yet see the value/logic in the method.
//+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ #property copyright "www,forex-station.com" #property link "www,forex-station.com" #property indicator_separate_window #property indicator_buffers 2 #property strict // // // // // extern ENUM_TIMEFRAMES TimeFrame = PERIOD_CURRENT; // Time frame input int FasterMA = 10; // Fast ma period input int FasterShift = 0; // Fast ma shift input ENUM_MA_METHOD FasterMode = MODE_EMA; // Fast ma mode input ENUM_APPLIED_PRICE FasterPrice = PRICE_CLOSE; // Fast ma price input int MediumMA = 20; // Medium ma period input int MediumShift = 0; // Medium ma shift input ENUM_MA_METHOD MediumMode = MODE_EMA;; // Medium ma mode input ENUM_APPLIED_PRICE MediumPrice = PRICE_CLOSE; // Medium ma price input int SlowerMA = 40; // Slow ma period input int SlowerShift = 0; // Slow ma shift input ENUM_MA_METHOD SlowerMode = MODE_EMA;; // Slow ma mode input ENUM_APPLIED_PRICE SlowerPrice = PRICE_CLOSE; // Slow ma price input int HistoWidth = 3; // Histogram bars width input color UpHistoColor = clrLimeGreen; // Bullish color input color DnHistoColor = clrRed; // Bearish color input bool alertsOn = true; // Alerts on true/false? input bool alertsOnCurrent = false; // Alerts open bar true/false? input bool alertsMessage = true; // Alerts message true/false? input bool alertsSound = true; // Alerts sound true/false? input bool alertsNotify = false; // Alerts notification true/false? input bool alertsEmail = false; // Alerts email true/false? input string soundfile = "alert2.wav"; // Sound file to use input bool arrowsVisible = true; // Arrows visible true/false? input bool arrowsOnNewest = false; // Arrows drawn on newest bar of higher time frame bar true/false? input string arrowsIdentifier = "ma Arrows1"; // Unique ID for arrows input double arrowsUpperGap = 1.0; // Upper arrow gap input double arrowsLowerGap = 1.0; // Lower arrow gap input color arrowsUpColor = clrBlue; // Up arrow color input color arrowsDnColor = clrCrimson; // Down arrow color input int arrowsUpCode = 233; // Up arrow code input int arrowsDnCode = 234; // Down arrow code input int arrowsUpSize = 2; // Up arrow size input int arrowsDnSize = 2; // Down arrow size double UpH[],DnH[],ma1[],ma2[],ma3[],valc[],count[]; string indicatorFileName; #define _mtfCall(_buff,_ind) iCustom(NULL,TimeFrame,indicatorFileName,PERIOD_CURRENT,FasterMA,0,FasterMode,FasterPrice,MediumMA,0,MediumMode,MediumPrice,SlowerMA,0,SlowerMode,SlowerPrice,HistoWidth,UpHistoColor,DnHistoColor,alertsOn,alertsOnCurrent,alertsMessage,alertsSound,alertsNotify,alertsEmail,soundfile,arrowsVisible,arrowsOnNewest,arrowsIdentifier,arrowsUpperGap,arrowsLowerGap,arrowsUpColor,arrowsDnColor,arrowsUpCode,arrowsDnCode,arrowsUpSize,arrowsDnSize,_buff,_ind) //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int OnInit() { IndicatorBuffers(7); SetIndexBuffer(0,UpH,INDICATOR_DATA); SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,HistoWidth,UpHistoColor); SetIndexBuffer(1,DnH,INDICATOR_DATA); SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,HistoWidth,DnHistoColor); SetIndexBuffer(2,ma1); SetIndexBuffer(3,ma2); SetIndexBuffer(4,ma3); SetIndexBuffer(5,valc); SetIndexBuffer(6,count); IndicatorSetDouble(INDICATOR_MINIMUM,0); IndicatorSetDouble(INDICATOR_MAXIMUM,1); indicatorFileName = WindowExpertName(); TimeFrame = MathMax(TimeFrame,_Period); SetIndexShift(2,FasterShift*TimeFrame/_Period); SetIndexShift(3,MediumShift*TimeFrame/_Period); SetIndexShift(4,SlowerShift*TimeFrame/_Period); IndicatorSetString(INDICATOR_SHORTNAME,timeFrameToString(TimeFrame)+" 3ma cross"); return(INIT_SUCCEEDED); } void OnDeinit(const int reason) { ObjectsDeleteAll(0,arrowsIdentifier+":"); } //------------------------------------------------------------------ // //------------------------------------------------------------------ int OnCalculate(const int rates_total, const int prev_calculated, const datetime& time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { int i,limit=fmin(rates_total-prev_calculated+1,rates_total-1); count[0] = limit; if(FasterShift < 0) limit = fmax(limit,-FasterShift); if(MediumShift < 0) limit = fmax(limit,-MediumShift); if(SlowerShift < 0) limit = fmax(limit,-SlowerShift); if (TimeFrame!=_Period) { limit = (int)fmax(limit,fmin(rates_total-1,_mtfCall(6,0)*TimeFrame/_Period)); for (i=limit;i>=0 && !_StopFlag; i--) { int y = iBarShift(NULL,TimeFrame,time[i]); UpH[i] = _mtfCall(0,y); DnH[i] = _mtfCall(1,y); } return(rates_total); } // // // for (i=limit;i>=0 && !_StopFlag; i--) { ma1[i] = iMA(_Symbol,_Period,FasterMA,FasterShift,FasterMode,FasterPrice,i); ma2[i] = iMA(_Symbol,_Period,MediumMA,MediumShift,MediumMode,MediumPrice,i); ma3[i] = iMA(_Symbol,_Period,SlowerMA,SlowerShift,SlowerMode,SlowerPrice,i); valc[i] = (i<rates_total-1) ? (ma2[i]>ma3[i] && ma1[i]>ma2[i]) ? 1 : (ma2[i]<ma3[i] && ma1[i]<ma2[i]) ? -1 : valc[i+1] : 0; UpH[i] = (valc[i] == 1) ? 1 : EMPTY_VALUE; DnH[i] = (valc[i] ==-1) ? 1 : EMPTY_VALUE; // // // if (arrowsVisible) { string lookFor = arrowsIdentifier+":"+(string)time[i]; if (ObjectFind(0,lookFor)==0) ObjectDelete(0,lookFor); if (i<(rates_total-1) && valc[i] != valc[i+1]) { if (valc[i] == 1) drawArrow(i,arrowsUpColor,arrowsUpCode,arrowsUpSize,false); if (valc[i] ==-1) drawArrow(i,arrowsDnColor,arrowsDnCode,arrowsDnSize, true); } } } manageAlerts(); return(rates_total); } //------------------------------------------------------------------- // //------------------------------------------------------------------- void manageAlerts() { if (alertsOn) { int whichBar = 1; if (alertsOnCurrent) whichBar = 0; if (valc[whichBar]!= valc[whichBar+1]) { static datetime time1 = 0; static string mess1 = ""; if (valc[whichBar] == 1) doAlert(time1,mess1," crossing up"); if (valc[whichBar] ==-1) doAlert(time1,mess1," crossing down"); } } } // // // void doAlert(datetime& previousTime, string& previousAlert, string doWhat) { string message; if (previousAlert != doWhat || previousTime != Time[0]) { previousAlert = doWhat; previousTime = Time[0]; // // // message = timeFrameToString(_Period)+" "+_Symbol+" at "+TimeToStr(TimeLocal(),TIME_SECONDS)+" 3 ma cross "+doWhat; if (alertsMessage) Alert(message); if (alertsNotify) SendNotification(message); if (alertsEmail) SendMail(_Symbol+" 3 ma cross ",message); if (alertsSound) PlaySound(soundfile); } } //------------------------------------------------------------------- // //------------------------------------------------------------------- void drawArrow(int i,color theColor,int theCode, int theSize, bool up) { string name = arrowsIdentifier+":"+(string)Time[i]; double gap = iATR(NULL,0,20,i); // // // datetime atime = Time[i]; if (arrowsOnNewest) atime += PeriodSeconds(_Period)-1; ObjectCreate(name,OBJ_ARROW,0,atime,0); ObjectSet(name,OBJPROP_ARROWCODE,theCode); ObjectSet(name,OBJPROP_COLOR,theColor); ObjectSet(name,OBJPROP_WIDTH,theSize); if (up) ObjectSet(name,OBJPROP_PRICE1,High[i] + arrowsUpperGap * gap); else ObjectSet(name,OBJPROP_PRICE1,Low[i] - arrowsLowerGap * gap); } // // // string sTfTable[] = {"M1","M5","M15","M30","H1","H4","D1","W1","MN"}; int iTfTable[] = {1,5,15,30,60,240,1440,10080,43200}; string timeFrameToString(int tf) { for (int i=ArraySize(iTfTable)-1; i>=0; i--) if (tf==iTfTable[i]) return(sTfTable[i]); return(""); }
DislikedIs there a script or indicator with a button to completely refresh chart in blank time? all the refreshing indicators I have found donīt do that, I need something which refreshes the chart as if I was switching timeframes, does that exist?Ignored
Disliked{quote} Thanks for sharing this, do you have the MQL version please? I have tried installing this on 3 different MT4 brokers but is not showing up in the indactors list. Thank you.Ignored
DislikedHi, BestTraderEv. Please, can you check this request and help if you can do that. Because without you nobody help. Thank you in advance. https://www.forexfactory.com/thread/...0#post14643370Ignored
Disliked{quote} No... Unfortunately EA is not working properly. it's opening non-stop orders in both sides and on the middle of rectangle... Something wrong {image}Ignored
Disliked@BestTraderEv, Could you help with coding candle scanner on the watchlist as shown on image below?? Thanks in advance {image}Ignored