Back to contacts

Daily pivot

Lugevho17
May 24 2015 at 11:54
25 ieraksti
Someone can tell me how to declare a daily pivot in a code?

Lugevho17
May 25 2015 at 07:53
25 ieraksti
I tried this:

double Hi = iHigh (NULL,1440,1);
double Lo= iLow (NULL,1440,1);
double Clo= iClose (NULL,1440,1);
double Pivot = (Hi + Lo + Clo)/3;

I'm not shure it returns the good value

Can someone help me?

Thank you

May 25 2015 at 08:24
1718 ieraksti
When you want to check the value... you print it:

Print('double Pivot= ',(Hi + Lo + Clo)/3);

Then you look at expert tab

Lugevho17
May 26 2015 at 08:16
25 ieraksti

Johan Laagland (jlaagland)
May 27 2015 at 17:34
8 ieraksti
void CalculatePivotLines()
{
int bar = 1;
if ( TimeDayOfWeek(iTime(Symbol(), PERIOD_D1, bar)) == 0 ) bar = 2;

YsHigh = iHigh(Symbol(),PERIOD_D1,bar);
YsLow = iLow(Symbol(),PERIOD_D1,bar);

PP = ( YsHigh + YsLow + iClose(Symbol(),PERIOD_D1,bar) ) / 3 ;
R = PP;
S = PP;

R = 2 * PP - YsLow;
R = PP + YsHigh - YsLow;
R = 2 * PP + YsHigh - 2 * YsLow;

S = 2 * PP - YsHigh;
S = PP + YsLow - YsHigh;
S = 2 * PP + YsLow - 2 * YsHigh;

LWsHigh = iHigh(Symbol(),PERIOD_W1,1);
LWsLow = iLow(Symbol(),PERIOD_W1,1);

WPP = ( LWsHigh + LWsLow + iClose(Symbol(),PERIOD_W1,1) ) / 3 ;
WR = WPP;
WS = WPP;

WR = 2 * WPP - LWsLow;
WR = WPP + LWsHigh - YsLow;
WR = 2 * WPP + LWsHigh - 2 * LWsLow;

WS = 2 * WPP - LWsHigh;
WS = WPP + LWsLow - LWsHigh;
WS = 2 * WPP + LWsLow - 2 * LWsHigh;
}

void CalculateFiboLines()
{
F = YsLow;
F = YsLow + 0.236 * (YsHigh - YsLow);
F = YsLow + 0.382 * (YsHigh - YsLow);
F = YsLow + 0.500 * (YsHigh - YsLow);
F = YsLow + 0.618 * (YsHigh - YsLow);
F = YsHigh;
F = YsLow + 1.618 * (YsHigh - YsLow);
F = YsLow + 2.618 * (YsHigh - YsLow);
F = YsLow + 4.236 * (YsHigh - YsLow);

F = YsLow - 1.618 * (YsHigh - YsLow);
F = YsLow - 2.618 * (YsHigh - YsLow);
F = YsLow - 4.236 * (YsHigh - YsLow);
}

Don (240Z)
May 27 2015 at 23:29
50 ieraksti
FYI: MetaTrader has a page with lots of ready made code, you only have to search 'Pivot' : www.mql5.com/en/code/mt4

“Everybody should have a dream. What if that dream comes true?” – Jack Ma
Lūdzu ienāciet, lai komentētu. 