up ....
The most probable reason why nobody has posted yet, is maybe because we don't understand your request and logic (well, at least I don't - maybe someone else does).
In your graph, your point "D" is in the future, yet your code calculates all points A to D from a history in the past, and in so doing draw your lines in the past and not in the future as you have referenced.
Also, why delete a Chart Object only to recreate it again? Just move it instead with "ObjectMove()". I am referring the the following line of code:
if(ObjectGet(name,OBJPROP_TIME1)!=t1 || ObjectGet(name,OBJPROP_PRICE1)!=pr1 || ObjectGet(name,OBJPROP_TIME2)!=t2 || ObjectGet(name,OBJPROP_PRICE2)!=pr2) {ObjectDelete(name);}
coordinates of the points calculation (this is example, code can be optimized)
int i; double APointPrice,BPointPrice,CPointPrice,DPointPrice,breaking; datetime APointTime,BPointTime,CPointTime,DPointTime; // start from zero bar i=0; // skip the first point breaking=0; while (breaking==0) { breaking=iCustom(NULL,0,"ZigZag",12,5,3,0,i); i++; } // point C breaking=0; while (breaking==0) { breaking=iCustom(NULL,0,"ZigZag",12,5,3,0,i); i++; } CPointTime=Time[i-1]; CPointPrice=breaking; Print("TimeC=",TimeToStr(CPointTime)," priceC=",CPointPrice); // point B breaking=0; while (breaking==0) { breaking=iCustom(NULL,0,"ZigZag",12,5,3,0,i); i++; } BPointTime=Time[i-1]; BPointPrice=breaking; Print("TimeB=",TimeToStr(BPointTime)," priceB=",BPointPrice); // point A breaking=0; while (breaking==0) { breaking=iCustom(NULL,0,"ZigZag",12,5,3,0,i); i++; } APointTime=Time[i-1]; APointPrice=breaking; Print("TimeA=",TimeToStr(APointTime)," priceA=",APointPrice); // point D DPointTime=(CPointTime-APointTime)+CPointTime; // Here you need to add the desired formula to calculate the projection if (APointPrice>CPointPrice) DPointPrice=CPointPrice-(APointPrice-CPointPrice); else DPointPrice=CPointPrice+(CPointPrice-APointPrice); Print("TimeD=",TimeToStr(DPointTime)," priceD=",DPointPrice);
thank you I'll test the code ...
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
I try to draw the projection of angle arms but I block
this is what I did to trace the angle based on the ZigZag
first two functions for the top and buttom like this
the parameters calling by reference for returning values bars indices
second function ObjectCreate to draw trend line
and some code in the start function like this it same working at the moment
this is what I have at the moment and what I want on the image below Last
if someone can help me