- Please fix this indicator or EA
- MqL4 Fractals
- High, Low, High-Low of previous bar MT4 indi
Hey RaptorUK, thanx for your quick answer!, i found this code
void MarkItDownX(int iBackBars, int iForwardBars) { // Other free stuff at http://www.selectfx.net/free_stuff_menu.htm int iHighIndex, iLowIndex; double dHi, dLo; datetime dtStart, dtEnd; // Get high/low of last n periods iHighIndex = iHighest(NULL, PERIOD_M5, MODE_HIGH, iBackBars, 1); iLowIndex = iLowest(NULL, PERIOD_M5, MODE_LOW, iBackBars, 1); dHi = iHigh(NULL, PERIOD_M5, iHighIndex); dLo = iLow(NULL, PERIOD_M5, iLowIndex); dtStart = TimeCurrent()-(iBackBars*300); // n*5 min bars dtEnd = TimeCurrent()+(iForwardBars*300); // n*5 min bars sstrCurrentUpLine = "X UP " + TimeToStr(TimeCurrent()); // Set current active line name sstrCurrentDownLine = "X DN " + TimeToStr(TimeCurrent()); ObjectCreate(sstrCurrentUpLine, OBJ_TREND, 0, dtStart, dLo, dtEnd, dHi); ObjectSet(sstrCurrentUpLine, OBJPROP_COLOR, Red); ObjectSet(sstrCurrentUpLine, OBJPROP_STYLE, STYLE_SOLID); ObjectSet(sstrCurrentUpLine, OBJPROP_WIDTH, 2); ObjectSet(sstrCurrentUpLine, OBJPROP_RAY, False); ObjectCreate(sstrCurrentDownLine, OBJ_TREND, 0, dtStart, dHi, dtEnd, dLo); ObjectSet(sstrCurrentDownLine, OBJPROP_COLOR, Blue); ObjectSet(sstrCurrentDownLine, OBJPROP_STYLE, STYLE_SOLID); ObjectSet(sstrCurrentDownLine, OBJPROP_WIDTH, 2); ObjectSet(sstrCurrentDownLine, OBJPROP_RAY, False); }
can you help me to adjust it to my purpose?
thank you a lot!
Hey RaptorUK, thanx for your quick answer!, i found this code
can you help me to adjust it to my purpose?
thank you a lot!
Please use the SRC button to post code . . .
I'll help you code it but I'm not coding it for you. If you don't know how get reading: https://book.mql4.com//
Please use the SRC button to post code . . .
I'll help you code it but I'm not coding it for you. If you don't know how get reading: https://book.mql4.com//
Thanx RaptorUK.. ill see what i can do and then ill post the code here...im really thankful for your help!
cheers
ok i have modify the code a bit.. but no good result
void MarkItDownX(int iBackBars, int iForwardBars) { // Other free stuff at http://www.selectfx.net/free_stuff_menu.htm int iHighIndex, iLowIndex; double dHi, dLo; datetime dtStart, dtEnd; iFractals(NULL,PERIOD_M5,MODE_HIGH,iBackBars); // Get high/low of last n periods iHighIndex = iHighest(NULL, PERIOD_M5, MODE_HIGH, iBackBars, 1); //iFractals(NULL,PERIOD_M5,MODE_UPPER,iBackBars); iLowIndex = iLowest(NULL, PERIOD_M5, MODE_LOW, iBackBars, 1); // iFractals(NULL,PERIOD_M5,MODE_LOWER,iBackBars); dHi = iFractals(NULL,PERIOD_M5,MODE_UPPER,iHighIndex); // iHigh(NULL, PERIOD_M5, iHighIndex); dLo = iFractals(NULL,PERIOD_M5,MODE_LOWER,iLowIndex); // iLow(NULL, PERIOD_M5, iLowIndex); dtStart = TimeCurrent()-(iBackBars*300); // n*5 min bars dtEnd = TimeCurrent()+(iForwardBars*300); // n*5 min bars sstrCurrentUpLine = "X UP " + TimeToStr(TimeCurrent()); // Set current active line name sstrCurrentDownLine = "X DN " + TimeToStr(TimeCurrent()); ObjectCreate(sstrCurrentUpLine, OBJ_TREND, 0, dtStart, dHi, dtEnd, High[0]); ObjectSet(sstrCurrentUpLine, OBJPROP_COLOR, Red); ObjectSet(sstrCurrentUpLine, OBJPROP_STYLE, STYLE_SOLID); ObjectSet(sstrCurrentUpLine, OBJPROP_WIDTH, 2); ObjectSet(sstrCurrentUpLine, OBJPROP_RAY, False); ObjectCreate(sstrCurrentDownLine, OBJ_TREND, 0, dtStart, dLo, dtEnd, Low[0]); ObjectSet(sstrCurrentDownLine, OBJPROP_COLOR, Blue); ObjectSet(sstrCurrentDownLine, OBJPROP_STYLE, STYLE_SOLID); ObjectSet(sstrCurrentDownLine, OBJPROP_WIDTH, 2); ObjectSet(sstrCurrentDownLine, OBJPROP_RAY, False); }
and i call the function with
MarkItDownX(20, 10);
thats what happen
it seams the lower trendline start correctly but is not touching the Low[0]..the upper trendline is not even on the highest fractal...
I know im close but maybe a little help?...
thank you
Hey Buddy, thanx for your help, i have a couple of questions..look at this
void MarkItDownX(int iBackBars, int iForwardBars) { int iHighIndex, iLowIndex; double dHi, dLo; datetime dtStartUP, dtStartDW, dtEnd; // Get high/low of last n periods iHighIndex = iHighest(NULL, PERIOD_M5, MODE_HIGH, iBackBars, 1); iLowIndex = iLowest(NULL, PERIOD_M5, MODE_LOW, iBackBars, 1); dHi = iFractals(NULL,PERIOD_M5,MODE_UPPER,iHighIndex); // High[iHighIndex]; dLo =iFractals(NULL,PERIOD_M5,MODE_LOWER,iLowIndex); // Low[iLowIndex]; dtStartUP = Time[iHighIndex];//TimeCurrent()-(iBackBars*300); // n*5 min bars dtStartDW = Time[iLowIndex]; dtEnd = Time[0];//TimeCurrent()+(iForwardBars*300); // n*5 min bars sstrCurrentUpLine = "X UP " + TimeToStr(TimeCurrent()); // Set current active line name sstrCurrentDownLine = "X DN " + TimeToStr(TimeCurrent()); ObjectCreate(sstrCurrentUpLine, OBJ_TREND, 0, dtStartUP, dHi, dtEnd, High[0]); ObjectSet(sstrCurrentUpLine, OBJPROP_COLOR, Red); ObjectSet(sstrCurrentUpLine, OBJPROP_STYLE, STYLE_SOLID); ObjectSet(sstrCurrentUpLine, OBJPROP_WIDTH, 2); ObjectSet(sstrCurrentUpLine, OBJPROP_RAY, False); ObjectCreate(sstrCurrentDownLine, OBJ_TREND, 0, dtStartDW, dLo, dtEnd, Low[0]); ObjectSet(sstrCurrentDownLine, OBJPROP_COLOR, Blue); ObjectSet(sstrCurrentDownLine, OBJPROP_STYLE, STYLE_SOLID); ObjectSet(sstrCurrentDownLine, OBJPROP_WIDTH, 2); ObjectSet(sstrCurrentDownLine, OBJPROP_RAY, False); }
i have changed the time values and now it works off course is not projecting n bars forward and backwards, but this will be the next step, my question is what iFractals returns? the index of the highest fractal n bars back(like iHighest) or the price? or should i do a loop? because what im trying to do is to get is the value of the previously highest fractal for the upper trendline and the previously lowest value of fractal for the lower trendline....
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use