How to make that Close Condition !
-
" if i have 10 running orders "
i want to make a condition :
if the( worst one = all win orders) , close them .. and recheck and compare the worst one againso i want to detect worst lose order and put it into variable A
and detect all win orders and put them into variable B
and compare themnote.. i expect result like :
order1 = -30$
order2 = -25$
order3 = -20$
order4 = -15$
order5 = -10$
order6 = -5$
order7 = 0$
order8 = +5$
order9 = +10$
order10 = +15$so the condition should close ( "order1"&"order8 & order9 & order10" ) because the sum of them are Zero
any one can help ?
-
Will all orders be running on the same chart or different ones?
-
@l-andorrà same chart
-
I have exactly the same problem. @FXDREEMA please help us to find a solution!
Thanks!
-
But which profitable trades should be closed? What if the sum of orders' profits is not zero? What if your worst loss is -50 pips and all 6 profitable trades sum +12 pips?
-
- Put all trades into an array
- Sort the array
- Pick the biggest loser
- Start summing up the biggest winners on the array, using a loop
- When ProfitSum > Loss
-> "Close most profitable trade" i times. You get i from the previous loop
-> "Close least profitable trade"
Here's the project, I'm sure there is still some bugs left, but close enough lol:
https://fxdreema.com/shared/Em63v0Sac

-
@roar woow! thanks!
-
And that's why being a true mql programmer is always better!

-
@l-andorrà I wish I was a real programmer lol. I don't even know the basics of mql.
I just copy from mql4 articles, try and fail and try again until I get my result.
Thats the beauty of this program, you can teach yourself -
@roar I tried to add another array to separate buys from sells but it doesn't seem to work. Could you take a look at shared project https://fxdreema.com/shared/Mq1YS72ge and tell me what I'm doing wrong?
Thank you!
-
@alexdepa said in How to make that Close Condition !:
@roar I tried to add another array to separate buys from sells but it doesn't seem to work. Could you take a look at shared project https://fxdreema.com/shared/Mq1YS72ge and tell me what I'm doing wrong?
Thank you!
@roar I found the errors I made in the second array. Thank you anyway.
-
@alexdepa I looked into it, the "once per bar" must reset the ActivateSystem variable - I think that is missing from the sell side.
Nice work applying my design, I really appreciate your diligence!
-
@roar Thank you...I'm trying to program this idea https://www.youtube.com/watch?v=S8E3xtR2omA&t=187s because I think it's really interesting but it's not easy at all...
-
@alexdepa Ok, good luck!
Personally I have zero interest in systems like this - the market doesn't care about your position management scheme, thus it will not generate a profit, only generates an illusion of profit.My advice: focus more on the chart, less on complicated position structures
-
@roar can you share your ex4? i can not download your ea .. thanks my email : wawaneumi@gmail.com