bOOb54bee4: what am i doing wrong here causing the trend line to not take price 2 position in the negative bars region?
There are no negative array elements, so you get Array Exceeded. You have to pass a actual time Time[i] - _Period*LineJump
bjectCreate(theName,OBJ_TREND,0,Time[i],price1,Time[i-LineJump],
WHRoeder:
There are no negative array elements, so you get Array Exceeded. You have to pass a actual time Time[i] - _Period*LineJump
There are no negative array elements, so you get Array Exceeded. You have to pass a actual time Time[i] - _Period*LineJump
okay, is it possible?
WHRoeder:
There are no negative array elements, so you get Array Exceeded. You have to pass a actual time Time[i] - _Period*LineJump
There are no negative array elements, so you get Array Exceeded. You have to pass a actual time Time[i] - _Period*LineJump
like what is the way to get the next time?
the next date & time in the calendar year.
WHRoeder:
There are no negative array elements, so you get Array Exceeded. You have to pass a actual time Time[i] - _Period*LineJump
There are no negative array elements, so you get Array Exceeded. You have to pass a actual time Time[i] - _Period*LineJump
how can i get my code to work
i wana set the LineJump to 5 and higher
bOOb54bee4: okay, is it possible?
Time[i] + _Period*LineJump
WHRoeder:
Time[i] + _Period*LineJump
Time[i] + _Period*LineJump
i've tried it but it doesnt seem to be the correct logic.. could you checkout this part
int start() { int LookBackNew; if(LookBack==0){ LookBackNew=Bars-1; }else{ LookBackNew=LookBack; } for(int i=LookBackNew; i>0; i--) // ..count backwards.. { if(ObjectFind("Lines"+IntegerToString(i))!=-1){ObjectDelete("Lines"+IntegerToString(i));} //- trend line up? if( Close[i]>Open[i] && Close[i-1]>Open[i-1] && Low[i]<Low[i-1] ) { ObjectCreate("Lines"+IntegerToString(i),OBJ_TREND,0, /* origin in time with specific price */ Time[i], Low[i], /* destination in time with specific price */ Time[i-LineJump], Low[i-1]-( (LineJump-1)*(Low[i]-Low[i-1]) )); ObjectSet("Lines"+IntegerToString(i),OBJPROP_RAY,LineRays);z ObjectSet("Lines"+IntegerToString(i),OBJPROP_COLOR,LinesUp); ObjectSet("Lines"+IntegerToString(i),OBJPROP_BACK,LineBack); ObjectSet("Lines"+IntegerToString(i),OBJPROP_WIDTH,LineWidth); } //- trend line down? if( Open[i]>Close[i] && Open[i-1]>Close[i-1] && High[i]>High[i-1] ) { ObjectCreate("Lines"+IntegerToString(i),OBJ_TREND,0, /* origin in time with specific price */ Time[i], High[i], /* destination in time with specific price */ Time[i-LineJump], High[i-1]-( (LineJump-1)*(High[i]-High[i-1]) )); ObjectSet("Lines"+IntegerToString(i),OBJPROP_RAY,LineRays); ObjectSet("Lines"+IntegerToString(i),OBJPROP_COLOR,LinesDown); ObjectSet("Lines"+IntegerToString(i),OBJPROP_BACK,LineBack); ObjectSet("Lines"+IntegerToString(i),OBJPROP_WIDTH,LineWidth); } } return(0); } //+------------------------------------------------------------------+
for(int i=LookBackNew; i>0; i--){ : Time[i-LineJump], Low[i-1]-( (LineJump-1)*(Low[i]-Low[i-1]) ));Previously answered. There is no Time[negative] what part of . "You have to pass an actual time Time[i] + _Period*LineJump" was unclear?
WHRoeder:
Previously answered. There is no Time[negative] what part of . "You have to pass an actual time Time[i] + _Period*LineJump" was unclear?
Previously answered. There is no Time[negative] what part of . "You have to pass an actual time Time[i] + _Period*LineJump" was unclear?
now your telling me its not possuble
correct?
WHRoeder:
Previously answered. There is no Time[negative] what part of . "You have to pass an actual time Time[i] + _Period*LineJump" was unclear?
my inclination tells me if i did period * period + time[0] i would still need a negative bar to send it to, buy your saying its not possible to do that.
Previously answered. There is no Time[negative] what part of . "You have to pass an actual time Time[i] + _Period*LineJump" was unclear?
bOOb54bee4: now your telling me its not possuble correct?
bOOb54bee4: my inclination tells me if i did period * period + time[0] i would still need a negative bar to send it to, buy your saying its not possible to do that. |
|
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
what am i doing wrong here causing the trend line to not take price 2 position in the negative bars region?
//+------------------------------------------------------------------+ //| HLTL-RAYS.mq4 | //| Copyright 2016, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2016, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict #property indicator_chart_window //+------------------------------------------------------------------+ color LinesDown = Lime;//Red; //SpringGreen; color LinesUp = White;//Blue;//Orchid; int LookBack = 250; int LineJump = 2; bool LineRays = false; int LineWidth = 1; bool LineBack = true; //+------------------------------------------------------------------+ int init() { ObjectDelete("BarTimer"); for(int i=Bars-1; i>0; i--) { ObjectDelete("Lines"+IntegerToString(i)); } return(0); } int deinit() { ObjectDelete("BarTimer"); for(int i=Bars-1; i>0; i--) { ObjectDelete("Lines"+IntegerToString(i)); } return(0); } //+------------------------------------------------------------------+ int start() { int LookBackNew; if(LookBack==0){ LookBackNew=Bars-1; }else{ LookBackNew=LookBack; } for(int i=LookBackNew; i>0; i--) // ..count backwards.. { if(ObjectFind("Lines"+IntegerToString(i))!=-1){ObjectDelete("Lines"+IntegerToString(i));} //- trend line up? if( Close[i]>Open[i] && Close[i-1]>Open[i-1] && Low[i]<Low[i-1] ) { ObjectCreate("Lines"+IntegerToString(i),OBJ_TREND,0, /* origin in time with specific price */ Time[i], Low[i], /* destination in time with specific price */ Time[i-LineJump], Low[i-1]-( (LineJump-1)*(Low[i]-Low[i-1]) )); ObjectSet("Lines"+IntegerToString(i),OBJPROP_RAY,LineRays); ObjectSet("Lines"+IntegerToString(i),OBJPROP_COLOR,LinesUp); ObjectSet("Lines"+IntegerToString(i),OBJPROP_BACK,LineBack); ObjectSet("Lines"+IntegerToString(i),OBJPROP_WIDTH,LineWidth); } //- trend line down? if( Open[i]>Close[i] && Open[i-1]>Close[i-1] && High[i]>High[i-1] ) { ObjectCreate("Lines"+IntegerToString(i),OBJ_TREND,0, /* origin in time with specific price */ Time[i], High[i], /* destination in time with specific price */ Time[i-LineJump], High[i-1]-( (LineJump-1)*(High[i]-High[i-1]) )); ObjectSet("Lines"+IntegerToString(i),OBJPROP_RAY,LineRays); ObjectSet("Lines"+IntegerToString(i),OBJPROP_COLOR,LinesDown); ObjectSet("Lines"+IntegerToString(i),OBJPROP_BACK,LineBack); ObjectSet("Lines"+IntegerToString(i),OBJPROP_WIDTH,LineWidth); } } return(0); }