| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Steve's Shell EA -SL and TP https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=1010 |
Page 1 of 1 |
| Author: | monkeyzu [ Sat Nov 17, 2012 12:50 pm ] |
| Post subject: | Steve's Shell EA -SL and TP |
Ok, i'm sure this must be easier than i'm finding it, but just can't get it to work (very green at programming as well not helping): I want to use Steve's Shell EA but not fixed stoploss, takeprofit and JumpingStop settings. If I have 2 values calculated for each new entry from indicators "LONG_STOP_LOSS" and "SHORT_STOP_LOSS", (depending on trade direction) where do i put them to replace the fixed values that come from the "extern" settings but still be able to use % position sizing, jumping stops etc? LONG_STOP_LOSS and SHORT_STOP_LOSS are prices, not pips, and I want my jumpingstop value to be the same distance as my initial stop. I'm sure this is very easy, but every time I think I've got it, I end up with some wacky backtest, usually tiny tp when should be much larger. |
|
| Author: | SteveHopwood [ Sat Nov 17, 2012 4:12 pm ] |
| Post subject: | Re: Steve's Shell EA -SL and TP |
The shell's are not really for beginner coders; I would imagine they are quite confusing. I publish them because I use them daily and it seems a shame to keep them to myself. Having said that, there is much within them that you can learn from. Although my shell, a lot of the code has been provided by some seriously clever programmers - their is an appreciation inside all the relevant functions. extern inputs such as TakeProfitPips are int to avoid confusing newbs with the decimal point, but they need to be converted into doubles to work with factor (calculated in PFactor() ). So, TakeProfitPips is read into the double TakeProfit in int init(). So, to remove any possibility of TakeProfit buggering up your calculations, delete it from the source code and recompile. Then follow all the error messages that result and delete the offending code snippet. |
|
| Author: | fxdaytrader [ Tue Dec 18, 2012 3:22 am ] |
| Post subject: | Re: Steve's Shell EA -SL and TP |
Hi monkeyzu, The longest journey starts with the first step you could change the pips allocated to the stoploss-variable in the function double CalculateStopLoss(int type). There you have to watch out for the OP_BUY/OP_SELL conditions. Add on the relevant positions e.g.: StopLoss = CalcDistance(price,YOURVALUE); where price = Ask/Bid depending on the ordertype and YOURVALUE the price you want to calculate the distance from. This would override the stoploss-settings. Further you have to add a new function to the shell: Code: Select all You may find examples in my post about my attempt to advance steve's shell ea code to build eas much easier (find it here). You will find the newest updates on the bottom. There you may find how you could solve that problem, I implemented i.a. much new functions for trailingstop and stoploss-calculation, and until now, they seem to work. It is not perfect (yet?), but a beginning. |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|