@jstap I can get the trade value of open trades and the value of the last closed trades. But how do I work out how much lot size to close.
e.g. I go 0.5 long, then 0.5 short.
The short trade closes out at say $100 in profit and the long trade is $150 in drawdown. I want to close out $80 of the trade in drawdown so I bank $20. How would you work out how much of the 0.50 lots to close out on the position in drawdown?
Latest posts made by btrader
-
RE: Close partially by amount of moneyposted in Questions & Answers
-
RE: Close partially by amount of moneyposted in Questions & Answers
Would also like to know how to do this. Anyone know a way to do the calculation?
-
Zero Divide Error With Brokers Using 1 Lot Minimumposted in Questions & Answers
Hi,
I have an EA which I built to trade stock indices and it works fine on all my normal brokers I use but there is one broker who forces you to use 1 lot increments and the EA just gives a 0 divide error. I've tested the EA on their FX pairs (allowing 0.01s) and it works fine so have narrowed it down to the fact they only allow 1.00 lots on the indices.
The error is thrown up in this line in the code generated by FXDreema:
size=MathRound(size/LotStep)*LotStep;
I assume thats to do with the lotstep but having searched through the forum for this Zero Divide error I can't find any solution that seems to work. Have a tried a few.
The EA doesn't use a stop loss and I even have it set to trade fixed lots and even when I set the lot size to 1 it still throws up the error.
Anyone have any ideas on a fix?
-
RE: Custom Code Conversion MT4 to MT5posted in Questions & Answers
@tipsywisdom That code makes the buttons work in the tester. It's a conversion from an MT4 EA built in FXDreema using the convertor to MT5. You didnt read the bloody post I posted did you. Suspect you are new

-
RE: Custom Code Conversion MT4 to MT5posted in Questions & Answers
Same error for each of the buttons.

-
Custom Code Conversion MT4 to MT5posted in Questions & Answers
I have just converted an MT4 project to MT5 using the convertor and all fine apart from some custom code I have to set button states after pressed in the tester.
I've used it in the MT4 version of an EA I'm building and it works perfectly.
Just converted my creation to MT5 and I get a compile error on all these blocks.What would be the MT5 version of this code?
ObjectSet(LoadedObjectName(),OBJPROP_STATE,0);The code is from this thread but think it's buried so deep people didnt see my question.

https://fxdreema.com/forum/topic/9883/working-buttons-in-strategytester
Any help much appreciated. -
RE: Working Buttons in StrategyTesterposted in Tutorials by Users
I have a question on this custom code for the buttons in the tester which sets the state after it's pressed.
I've used it in the MT4 version of an EA I'm building and it works perfectly.
Just converted my creation to MT5 and I get a compile error on all these blocks on the buttons.What would be the MT5 version of this code?
ObjectSet(LoadedObjectName(),OBJPROP_STATE,0); -
RE: Calculating ADR in pips Wrong for JPY Pairsposted in Questions & Answers
Anyone coming across this in the future I found the solution.
Searched for this but couldnt find it and stumbled across it while reading tutorials.
https://fxdreema.com/forum/topic/11003/atr-value-to-pips-tutorial/2
Handles JPY calculations perfectly. -
RE: Calculating ADR in pips Wrong for JPY Pairsposted in Questions & Answers
@roar So how would I implement that in the project?
https://fxdreema.com/shared/xZfhyTE4e
The modify variables there saves the ADR as a pip amount. Not sure how to use your formula, not a coder and just working visually with the system.
-
RE: Calculating ADR in pips Wrong for JPY Pairsposted in Questions & Answers
@roar I need an inpu to set a target which is an amount of pips but based off ADR.
i.e. half the ADR10 value if 50 would be 25.