Hi everyone !
I'm looking for two scripts :
1/ for BUY orders :
- SL on low (+spread/2)
- open the order at the close of the current candlestick
- TS
2/ for SELL orders :
- idem
Both should have a money management : 3% of capital. So to calculate the size : capital*300/SL
The particularity i would have is the TS :
I want it according to SL value so :
Code:
///SL
spread = abs(bid - ask)
If long = 1 then
SL = bid – (low - spread/2)
If short = 1 then
SL = (high + spread/2) - ask
End
///TS
If SL =< 5 then
TS = 4 * SL
If 5 < SL =< 7 then
TS = 3 * SL
If 7 < SL =< 11 then
TS = 2 * SL
If 11 < SL =< 20 then
TS = 1.5 * SL
If 20 < SL =< 30 then
TS = SL
If SL > 30 then
No Order
End
///lot size
Taille = Capital*300/SL
///orders
If long = 1 and SL<30 then
BUY at close ; lot = Taille ; StopLoss = bid – SL ;TrailingStop = bid + TS
Si short = 1 and SL<30 then
SELL ar close ; lot = Taille ; StopLoss = ask + SL ;TrailingStop = ask - TS
Fin
Thank you so much from South France (what a SUN today!! http://www.forex-tsd.com/images/smilies/biggrin.gif), have a nice day
I'm looking for two scripts :
1/ for BUY orders :
- SL on low (+spread/2)
- open the order at the close of the current candlestick
- TS
2/ for SELL orders :
- idem
Both should have a money management : 3% of capital. So to calculate the size : capital*300/SL
The particularity i would have is the TS :
I want it according to SL value so :
Code:
///SL
spread = abs(bid - ask)
If long = 1 then
SL = bid – (low - spread/2)
If short = 1 then
SL = (high + spread/2) - ask
End
///TS
If SL =< 5 then
TS = 4 * SL
If 5 < SL =< 7 then
TS = 3 * SL
If 7 < SL =< 11 then
TS = 2 * SL
If 11 < SL =< 20 then
TS = 1.5 * SL
If 20 < SL =< 30 then
TS = SL
If SL > 30 then
No Order
End
///lot size
Taille = Capital*300/SL
///orders
If long = 1 and SL<30 then
BUY at close ; lot = Taille ; StopLoss = bid – SL ;TrailingStop = bid + TS
Si short = 1 and SL<30 then
SELL ar close ; lot = Taille ; StopLoss = ask + SL ;TrailingStop = ask - TS
Fin
Thank you so much from South France (what a SUN today!! http://www.forex-tsd.com/images/smilies/biggrin.gif), have a nice day