Hi there
I need help with calculating some (for me) complex stuff!
I am building an EA which trades grids. I use thes grid trades when price goes against me.
An example:
I buy EURUSD at 1.1000 - 0.1 lot.
Price goes against me and I take a new buy trade every 10 pips. (All same lotsize)
Lets say price goes 100 pip against me, meaning I have 10 buy trades in loss and price is now
1.0900. In total 10 trades, 0.1 lot per trade = 1.0 lot in total, but all opened at different levels.
0.1 lot is 100 pips in minus
0.1 lot is 90 pips in minus
0.1 lot is 80 pips in minus etc..
What I want the EA to do now, is take a hedge trade. My big headache is now to calculate the lotsize of this hedge trade (sell trade) to create a perfect hedge/ a hedge which is correct lotsize. Lets say I am in total loss with 200 USD, then the hedge trade shall "lock in" that loss (of course not incl. commission and swap etc)
I mean, just selling 1.0 lot (sum of the open buy trades) is not a perfect hedge, or the correct lotsize.
I wish to have a lotsize on this sell trade, which makes every future pipmove even out/ hedge the current buy trades..
Can some brilliant person help with any input/ formula?
Thanks a lot
PC
I need help with calculating some (for me) complex stuff!
I am building an EA which trades grids. I use thes grid trades when price goes against me.
An example:
I buy EURUSD at 1.1000 - 0.1 lot.
Price goes against me and I take a new buy trade every 10 pips. (All same lotsize)
Lets say price goes 100 pip against me, meaning I have 10 buy trades in loss and price is now
1.0900. In total 10 trades, 0.1 lot per trade = 1.0 lot in total, but all opened at different levels.
0.1 lot is 100 pips in minus
0.1 lot is 90 pips in minus
0.1 lot is 80 pips in minus etc..
What I want the EA to do now, is take a hedge trade. My big headache is now to calculate the lotsize of this hedge trade (sell trade) to create a perfect hedge/ a hedge which is correct lotsize. Lets say I am in total loss with 200 USD, then the hedge trade shall "lock in" that loss (of course not incl. commission and swap etc)
I mean, just selling 1.0 lot (sum of the open buy trades) is not a perfect hedge, or the correct lotsize.
I wish to have a lotsize on this sell trade, which makes every future pipmove even out/ hedge the current buy trades..
Can some brilliant person help with any input/ formula?
Thanks a lot
PC
Less is more...