Trying to make an EA that will autocalculate how many lots I should trade for a given risk amount.
e.g.
say I want to long euro/usd at 1.35, TP at 1.36 with a stop loss at 1.33. I only want to risk 3.5% of my account on this trade and my account has $10,000.
so 10,000*0.035 = 350, 350/200 = 1.75. Thus each pip needs to be worth $1.75 dollars, equivalent to 1.75 mini lots (17,500 euro's).
Once I nominate how much risk (percentage wise) I want to take, what my entry price is and my stop level. I want the ea to autocalculate the rest. (lots traded, set pending entry, TP and stop prices)
My entry is 1 pip above the price I enter at and my stop is a few pips below my stop price.
I've tried coding this myself however its not compiling. If anyone can help I'd greatly appreciate the assistance.
You may notice my TP is half my SL. if you disagree with this approach I understand your concerns however this is simply a strategy I am forward testing. there's no reason for debates
You also may notice at TP it only takes off 70% of the position. I let 30% ride to make more profit (I've prooved in testing this works better)
If you do fix and need it for any purpose, please feel free to distribute if you know anyone who wants it. It's got my name on it but I don't really care.
Cheers,
Scotty
e.g.
say I want to long euro/usd at 1.35, TP at 1.36 with a stop loss at 1.33. I only want to risk 3.5% of my account on this trade and my account has $10,000.
so 10,000*0.035 = 350, 350/200 = 1.75. Thus each pip needs to be worth $1.75 dollars, equivalent to 1.75 mini lots (17,500 euro's).
Once I nominate how much risk (percentage wise) I want to take, what my entry price is and my stop level. I want the ea to autocalculate the rest. (lots traded, set pending entry, TP and stop prices)
My entry is 1 pip above the price I enter at and my stop is a few pips below my stop price.
I've tried coding this myself however its not compiling. If anyone can help I'd greatly appreciate the assistance.
You may notice my TP is half my SL. if you disagree with this approach I understand your concerns however this is simply a strategy I am forward testing. there's no reason for debates
You also may notice at TP it only takes off 70% of the position. I let 30% ride to make more profit (I've prooved in testing this works better)
If you do fix and need it for any purpose, please feel free to distribute if you know anyone who wants it. It's got my name on it but I don't really care.
Cheers,
Scotty
Attached File(s)
Order Taker.mq4
3 KB
|
257 downloads