Previous Part 2,
click hereLet us discuss
the above code one by one:
1. #
Property copyright "xxxx" code indicates ownership of an EA. This code works only when back testing course which will display the owner's name behind his name EA. See fig.
2. #
Property link code indicates the maker EA link, in this case 'me'.
3.
MagicNumber variable is used as an identifier order by EA. Only orders made by EA that has MagicNumber.
4.
StartLot variable indicating the amount of lots traded by EA basis. This variable is named StartLot Why? Because if the martingale feature enabled, This StartLot is the beginning of the arrangement lot of different magnitude
5.
This StopLoss variable indicates
stoploss levels if the market moves against.6.
Takeprofit variable shows how much our profit target in pips per order made by EA
7.
TrailingStop variable shows how many pips in each direction will shift stoplossnya profit EA.
8.
MoveToBreakEvent variable if set to true, after the price moves towards the profit of stoplevel + LockedPips, then stoploss will be moved to the opening price + / - LockedPips,depending on the type of orders
9.
LockedPips read no. 8
10.
RSIPeriod variable indicates the number of bars is calculated to obtain the value of RSI
11.
UpperLevel variable to determine overbought
12.
LowerLevel variable to determine oversold
13.
Martingale variable if set to true, then the martingale function in this EA will be activated
14.
This variable multiplier is multiplication factor that used to determine the amount of lots on the next order if the previous order is loss and the function of the martingale EA is enabled
15.
DeepLevel variable is used to determine how many levels deep martingale defeat of lot will be covered or duplicated over and over in the event of loss neberus row.
16.
StartHour variables used to determine the clock starts trading
17.
EndHour variables used to define the clock stops trading
Next we create an important function for this EA, the
Counting Order Function.
More or less code of
Counting Order Functions are as follows:
This function produces how many open orders are only made by the EA. Other orders suppose we open another order both in the same pair or a different pair will not be counted.
Next we will create other functions that are not less important than the previous function.That is the
checkforlosses function of the order recently closed.
I use code like this:
advantage of this function it will still be able to recognize orders made by EA and consider it a loss of orders or a profit even if the owner of EA makes a lot of orders manually.
Other functions that need to be made is lastlot. Lastlot used to determine lotsize of an order after found a loss by The CheckforLoss function above.
The code is like this:
This Function is to calculate Lot amount even the martigale is actived or not
Continued......