Please explain me this.

 

Here is what i ran onto on one forum, i would like some of the code understanding people expllain this to me, what is the buy criteria and what is the long criteria ?

Tha code :

if (h[1]+l[1]+o[1]+c[1])/4open[0] then buy

if (h[1]+l[1]+o[1]+c[1])/4>(ask+bid)/2 and bid<open[0] then sell

 
Ravique:
Here is what i ran onto on one forum, i would like some of the code understanding people expllain this to me, what is the buy criteria and what is the long criteria ? Tha code : if (h[1]+l[1]+o[1]+c[1])/4open[0] then buy if (h[1]+l[1]+o[1]+c[1])/4>(ask+bid)/2 and bid<open[0] then sell

the first line equates to: if the average price of the last candle is less than the current mid priceAND the current ask price is greater than the current open then buy

the second line equates to: if the average price of the last candle is greater than the current mid priceAND the current bid price is less than the current open then sell

use this logic at your own peril

 

>> if (h[1]+l[1]+o[1]+c[1])/4open[0] then buy

If (High + Low + Open + Close) / 4 of previous candle is less than the average of bid/ask price, and current ask price is higher than open price.

>> if (h[1]+l[1]+o[1]+c[1])/4>(ask+bid)/2 and bid<open[0] then sell

If (High + Low + Open + Close) / 4 of previous candle is higher than the average of bid/ask price, and current bid price is less than open price.

 

Thank s Scorpion

 

You're welcome. But remember that above code is not equivalent in MQLII and MQL4, as the mt3 and mt4 bars formation is totally different. (if it's mql2 then use it in mql2 only, if it's mql4 then use it in mql4 only).

 

The OHLC Data remains the same for all the trading platform. And the bid + ask / 2 price - is a way to find a middle price.

Anyways, there are not so many rules to this, but the trade enter criteria is nice, can there be a MA with this kind of formula : (h[1]+l[1]+o[1]+c[1])/4 . This could end up beoing a nice system

 

No, OHLC data varies in some platforms. OHLC in MT3 is completely different from that of MT4. In mt3, Bid and Ask prices are combined to generate OHLC, whereas in mt4, only bid is used to generate OHLC. Remember I asked how to Normalize is calculated?

 

Yeah, I do remember It.

Reason: