• 信息
8+ 年
经验
0
产品
0
演示版
0
工作
0
信号
0
订阅者
William Tapia Diaz
William Tapia Diaz
To whom have purchased TrendLine Drawing with Angles Calculation, here goes the mql4 codes in order to get the angles values:

First: We have to get the trendlines names:

We use a new variable:

int indicatorName;

If:
indicatorForSwingCalculation=RSI ==> indicatorName=1
indicatorForSwingCalculation=AC ==> indicatorName=2
indicatorForSwingCalculation=AO ==> indicatorName=3
indicatorForSwingCalculation=ZigZag ==> indicatorName=4

(Being "indicatorForSwingCalculation" an input when indicator is started)


Then we get the name of Resistance and Support lines:

resistanceName="Resistance-"+(string)(int) indicatorName +"-"+(string)(int)period;

supportName="Support-"+(string)(int) indicatorName +"-"+(string)(int)period;


(Being "period" an input when indicator is started)


//////

Second: We get the angles value with next codes:

For Resistance Line:

We create a new variable:

string completeDescription=ObjectGetString(0, resistanceName,OBJPROP_TEXT,0);

Create another variable for store the angle value in string (obviously you can get the double immediately):

string angleStr=StringSubstr(completeDescription,StringFind(completeDescription,"Angle: ",0)+7,(StringFind(completeDescription," º",0))-(StringFind(completeDescription,"Angle: ",0)+7));


Finally:

double resistanceAngle=(double)angleStr;
--

For Support Line (the same thing but this time with the name of support line):

Create a new variable:

string completeDescription=ObjectGetString(0, supportName,OBJPROP_TEXT,0);

Create another variable for store the angle value in string (obviously you can get the double immediately):

string angleStr=StringSubstr(completeDescription,StringFind(completeDescription,"Angle: ",0)+7,(StringFind(completeDescription," º",0))-(StringFind(completeDescription,"Angle: ",0)+7));


Finally:

double supportAngle=(double)angleStr;