a question about order, plz help

 

Hi I am confusing in coding a simple EA, plz help

The problem is : If a fast MA cross a slow MA that produce a golden cross condition, then I want it to buy when the tick(price) equal or below the slow moving average value after confirming the golden cross condition, and if the price does not equal or below the slow MA, I need the order keep placing (or keep buying) until  the order finnaly deal.


plz help , thank you!

 
iskyjoe2016:

Hi I am confusing in coding a simple EA, plz help

The problem is : If a fast MA cross a slow MA that produce a golden cross condition, then I want it to buy when the tick(price) equal or below the slow moving average value after confirming the golden cross condition, and if the price does not equal or below the slow MA, I need the order keep placing (or keep buying) until  the order finnaly deal.


plz help , thank you!


Look at this:

Forum on trading, automated trading systems and testing trading strategies

Requests & Ideas (MQL5 only!)

Vladimir Karputov, 2017.05.22 17:41

Crossing of two iMA .

Intersection of two (iMA, Moving Average), as the filter - the third indicator (iMA, Moving Average).

Calculation of the volume of the position ( Lot ): either manually or the risk as a percentage of the balance.

Method of trading: Stop-, Market- or Limit-orders. Also put up Stop Loss, Take Profit, Trailing Stop.

Input parameters:

  • "Parameters of the first Moving Average";
    • Period of the first Moving Average
    • Shift of the first Moving Average
    • Method of the first Moving Average
  • "Parameters of the second Moving Average";
    • Period of the second Moving Average
    • Shift of the second Moving Average
    • Method of the second Moving Average
  • "Parameters of the Third Moving Average";
    • Third indicator Moving Average - filter
    • Period of the third Moving Average
    • Shift of the third Moving Average
    • Method of the third Moving Average
  • "Parameters of Money Management";
    • True -> lot is manual, false -> percentage of risk from balance
    • Lots (use only if lot size is manual)
  • "Parameters of trading";
    • Risk in percent for a deal from balance
    • (In pips) <0 -> Stop orders, = 0 -> Market,> 0 -> Limit orders
    • Stop Loss (in pips)
    • Take Profit (in pips)
    • Trailing Stop ("0" -> not trailing)
    • Trailing Step (use if Trailing Stop> 0)
    • Magic number
    • Slippage

Reason: