Hi Everyone,
I've run into a wall with code and need some help to understand what is wrong with it. I'm no programmer by the way but I didn't really think this would be that difficult but its stretched me and I'm making it worse.
Its close EAs originally based on code by a clever programmer called Kimi.
It is cycling through all the open trade orders to set stops, but it doesn't apply the close half bit and I don't know why.
The idea is it sits on one chart and manages (cycles through) all open trades past and present whatever their state.
If there is no SL it puts a SL in place (which seems to work ok)
If the trade moves up a bit then it can adjust the SL a bit.
Once a trade (any trade on any chart/pair) hits + xx pips it should close half and set SL to BE.
But I run into several problems, one attempt I made it just went crazy and closed all trades, I tried to introduce a condition if orderlots() > preserve_lots to stop it closing everything but then I found it was ignoring trades so I think I've gone a long way backwards.
Would anyone be kind enough to cast their eye over this and show me where I am going wrong I've got my self really confused.
Code is attached.
## Or, is it possible (better if it is possible) to change the e MoveSLTP by mouse code attached to close half, i,e you can set TP to 50%, not the full close out. I looked for order lots in the code but it is not there so I don't know how to change it.
and a big thank you in advance if anyone can help me with either of these.
PG
I've run into a wall with code and need some help to understand what is wrong with it. I'm no programmer by the way but I didn't really think this would be that difficult but its stretched me and I'm making it worse.
Its close EAs originally based on code by a clever programmer called Kimi.
It is cycling through all the open trade orders to set stops, but it doesn't apply the close half bit and I don't know why.
The idea is it sits on one chart and manages (cycles through) all open trades past and present whatever their state.
If there is no SL it puts a SL in place (which seems to work ok)
If the trade moves up a bit then it can adjust the SL a bit.
Once a trade (any trade on any chart/pair) hits + xx pips it should close half and set SL to BE.
But I run into several problems, one attempt I made it just went crazy and closed all trades, I tried to introduce a condition if orderlots() > preserve_lots to stop it closing everything but then I found it was ignoring trades so I think I've gone a long way backwards.
Would anyone be kind enough to cast their eye over this and show me where I am going wrong I've got my self really confused.
Code is attached.
## Or, is it possible (better if it is possible) to change the e MoveSLTP by mouse code attached to close half, i,e you can set TP to 50%, not the full close out. I looked for order lots in the code but it is not there so I don't know how to change it.
and a big thank you in advance if anyone can help me with either of these.
PG
Attached File(s)
close_half.mq4
6 KB
|
153 downloads
e-MoveSLTPbyMouse.mq4
16 KB
|
151 downloads