How identify previous low or high from zigzag

How identify previous low or high from zigzag

Manage alerts

Loading saved threads...

linlin · External communityPost link
External question — Stack Overflow Stack Exchange Author: linlin Original post: https://stackoverflow.com/questions/64402836 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. 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 zigzag
Quote
Report
noSkill06s · External communityPost link
External answer — Stack Overflow Stack Exchange Author: noSkill06s Original post: https://stackoverflow.com/a/64409037 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. 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
Quote
Report
Mohamed FAIDA · External communityPost link
External answer — Stack Overflow Stack Exchange Author: Mohamed FAIDA Original post: https://stackoverflow.com/a/71344408 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. 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 );
Quote
Report

Post Reply

Checking account access…