Reputation: 25
this is icustom calling function and get low ang high value.
double highzigzag = iCustom(NULL,0,"ZigZag",InpDepth,InpDeviation,InpBackstep,1,0);
double lowzigzag = iCustom(NULL,0,"ZigZag",InpDepth,InpDeviation,InpBackstep,2,0);
And how can code previous low and high value to compare as
if previous low > current low ,continue trend
if previous low < current low ,trend change
Upvotes: 0
Views: 3834
Reputation: 156
Just to complet what has been said by @noSkill06s here is the loop
int longRange = 100;
double highzigzag = 0,
lowzigzag = 0;
for(int i = 1;i<longRange;i++){
highzigzag =
iCustom(Symbol(),PERIOD_CURRENT,"ZigZag",InpDepth,InpDeviation,InpBackstep,1,i);
if(highzigzag!=0) break;
}
for(int i = 1;i<longRange;i++){
lowzigzag =
iCustom(Symbol(),PERIOD_CURRENT,"ZigZag",InpDepth,InpDeviation,InpBackstep,2,i);
if(lowzigzag!=0) break;
}
Comment("hight :"+highzigzag +"\nLow : "+lowzigzag );
Upvotes: 0
Reputation: 31
the last placeholder at the function "iCustom(......,X)" is the number of the Bar u want to check in your code: double highzigzag = iCustom(NULL,0,"ZigZag",InpDepth,InpDeviation,InpBackstep,1,HERE); double lowzigzag = iCustom(NULL,0,"ZigZag",InpDepth,InpDeviation,InpBackstep,2,HERE);
u are checking with 0 = Current OpenBar
u need to change it to 1=First Finished Bar or 2=Second Finished Bar as example
double highzigzag = iCustom(NULL,0,"ZigZag",InpDepth,InpDeviation,InpBackstep,1,1);
double lowzigzag = iCustom(NULL,0,"ZigZag",InpDepth,InpDeviation,InpBackstep,2,1);
in this example i'm checking the first finished bar but instead of typing the bar number u should use the function within a for-loop and replace the bar number through "i"
if it helps dont forget to like
Upvotes: 2