Hi
I wrote this code. User input SL and TP and Volume..
The program with rand() function give us odd / even.
For example: if return Even ,open buy position....and if return Odd : open sell position.
After the price hit the TP/SL then open another position . (According to : odd/even)
I have a Problem(BIG PROBLEM):
when user set TP and SL and Volume... the problem appear (Mostly) for second position and rest of the positions.
the TP and SL changing automaticly!!!!!!
For example: User input TP:20.........SL : 10............ For first position it is ok (Mostly). For other position it changes to :
TP : 18 ...... SL : 12
Or
TP : 16 ..... SL : 14
Or
TP : 13 ..... SL : 17
And i do not know WHY...
Thanks.
The problem is probably because the TP of a buy is triggered when price=BID, and than you issue say another buy with the ask, which is 2 pips above your exit price (the bid) and you get at the end result that your first TP exit is not the same as your new ask (because exit in bid and entry in ask).

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
I wrote this code. User input SL and TP and Volume..
The program with rand() function give us odd / even.
For example: if return Even ,open buy position....and if return Odd : open sell position.
After the price hit the TP/SL then open another position . (According to : odd/even)
I have a Problem(BIG PROBLEM):
when user set TP and SL and Volume... the problem appear (Mostly) for second position and rest of the positions.
the TP and SL changing automaticly!!!!!!
For example: User input TP:20.........SL : 10............ For first position it is ok (Mostly). For other position it changes to :
TP : 18 ...... SL : 12
Or
TP : 16 ..... SL : 14
Or
TP : 13 ..... SL : 17
And i do not know WHY...
Thanks.