Newbie needs help with MA buffers

 

Hi,

Can someone please help me. I am trying to build a simple range trading system in Mql4 and I'm having problems.

I need to create a SMA with an upper band (+6 pips) and a lower band (-6Pips).

If the current bar open is > lowerband[1] and < upperband[1] and Askprice falls below lowerband[1], Open Buy order and attach stoploss (-28pips).

if order type == opbuy and bidprice > upperband[1], Close order.

--------------------------

This is just an excercise to help me understand array processing in Mql4. If anyone can help me learn or has any links to relevant codebase material, I would appreciate very much.

Thanks, Chris.

 

I'm kinda a newbie too, but I'll try to help you. However, the program logic of "If the current bar open is > lowerband[1] and < upperband[1] and Askprice falls below lowerband[1]" seems near impossible to me. Translation in my mind, "If the current bar open is > lowerband[1] and < upperband[1]" = if (Price is Greater than Lower Band) && (Price is Less than Upper Band)... So far, we're all good as price needs to be within Middle of bands. But what follows: "and Askprice falls below lowerband[1]" = && (Price is Less than Lower Band).

 

Price simply cannot be (Grater than Lower band) && (Less than Lower Band ) at the same time. Clarify the Logic and we'll go from there.

Reason: