Job finished
Specification
i want to develop a MQL4 EA, pls see the strategy below
Some other requirements
1. I want to just hold 1 buy and 1 sell position at the same time (for some circumstances, it is possible that buy and sell postion holding at the sanme time). but since this EA will be use in the account that will use other EAs too, so just use “OrdersTotal() == 0” is not work, we may need to use Magic number to differentiate with other trades that made by other EAs
2. The chart only show the buy trade, but i need the sell trade too, just all criteria reverse
3. Pls note that Buy Stop and Sell Stop may not be executed, because, for example, we may not get a higher price after EMA 24 crossing up EMA 60, I don’t know how would effect the coding, just raise it
4. I want to keep the code in void OnTick() as simple as possible, something like this (it is just a template i copy from other, you no need, or i don' think you can straightly apply) i want the other parts are coded as functions, then i can apply them to other EA easily (for example, i may use the Trailing Stop code for other trading strategy EA):
void OnTick() { //--- // Get the profit target price and the stop loss price double Long_TakeProfitLevel = Bid + Profit_target*Point; //0.0001 double Long_StopLossLevel = Bid - Stop_loss*Point; double Short_TakeProfitLevel = Ask - Profit_target*Point; //0.0001 double Short_StopLossLevel = Ask + Stop_loss*Point; // Check if the long condition happen and place order accordingly if (Enter_long() ) //if more the one signal, could be Enter_long1, Enter long2 or Signal1, Signal2... //OrdersTotal depend on strategy { Open_Enter_long(Lot_size,Long_TakeProfitLevel,Long_StopLossLevel,"First_Enter"); } else if (Exit_long()) { Close_Exit_long("Close_Exit_long"); } // Check if the short condition happen and place order accordingly if (Enter_short() ) //if more the one signal, could be Enter_long1, Enter long2 or Signal1, Signal2... //OrdersTotal depend on strategy { Open_Enter_short(Lot_size,Short_TakeProfitLevel,Short_StopLossLevel,"First_Enter"); } else if (Exit_short()) { Close_Exit_short("Close_Exit_short"); } }Finally , i am not good at coding, i hope you can give me simple description on importantline of code , and the code must be testable by backtest , then i can check it faster and pay you faster, and both of us win-wn.
