Writing EA Code

salyafei

Trader
Mar 20, 2013
3
0
12
I want to write an EA so that it reopens a buying order when the price is 10 pip less than the previous closed buying order price and to reopen a selling order when the price is 10 pip more than the previous closed selling order price.

Can any body help??
 

salyafei

Trader
Mar 20, 2013
3
0
12
For opening a budying position only whenever a new candle, one position at a time. (The opposite applies for openning a selling position)
1. Stochastic (5,3,3, low/high/, previous previous bar, mode main) > Stochastic (5,3,3, low/high, previous previous bar, mode signal)
2. Stochastic (5,3,3, low/high/, current bar, mode main) > Stochastic (5,3,3, low/high, previous bar, mode main)
3. Stochastic (5,3,3, low/high/, current, mode Signal) > Stochastic (5,3,3, low/high, previous bar, mode Signal)
4. RSI (14, current bar, price close)> RSI (14, current bar, price open)
5. RSI (14, current bar, price close)> RSI (14, previous bar, pri ce close)
6. Take Profit is 5 pips (variable)
7. If Take profit is not met close order only if Stochastic (5,3,3, low/high/, previous bar, mode main) < Stochastic (5,3,3, low/high, previous bar, mode signal)

8. If Take Profit is met, initiate trailing stop to secure the 5 pips, and increase take profit by 1 pip stepwise)
9. If buying position is closed in the same candle and condition applies, reopen a buying position if the price is 10 pip less than the price at which the previous buying position was closed. This rule is repeated.
 

Ixbone

Master Trader
Jan 25, 2012
16
1
69
Austria
ixbone.com
you can store the last price of the last opened order and type (buy,sell)
in two variables and add 10 pips to bid/ask (+spread)

hope this gives you some ideas

Michael