Grid orders with one combined stop loss and limit, can it be done?
Forums › ProRealTime English forum › ProOrder support › Grid orders with one combined stop loss and limit, can it be done?
- This topic has 307 replies, 1 voice, and was last updated 7 months ago by OtherAttorney.
-
-
10/06/2016 at 12:22 PM #14377
With the Highest and Lowest instructions, you already have everything necessary to give you the values to compare. About your Coppock recent highest high and lowest low over a X period, this is how to get it:
12345X = 20 //how much period lookback?//change "mycoppock" to your real variable namehh = highest[X](mycoppock)ll = lowest[X](mycoppock)1 user thanked author for this post.
10/07/2016 at 4:08 AM #14415If I have understood @cfta the plan is still to manually start the TS and I think I can see why. Finding a reliable entry signal on a m1 could be very difficult in my opinion (due to no multi time frame capability), so what we need is a reliable entry signal from a higher timeframe to manually start this Grid Orders with 1 combined stop and limit trading system. This highlights another shortcoming of PRT you cannot set a email/sms/phone notification of a potential entry from a demo account or ProScreener.
I read about the Coppock indicator and its supposed to be for a higher timeframe. Of course just because it supposed to be for a higher timeframe doesn’t mean it won’t work.
My suggestion is to consider how we could find a reliable entry system at higher timeframe and if many of us have the platform running throughout the world and entry signal appears we send out an email to a email group list.
10/07/2016 at 8:13 AM #14419A new topic here where everyone has subscribed would also be an excellent idea to share the detected signals and to have an “history” of what were the good ones compared to the bad ones.
1 user thanked author for this post.
10/12/2016 at 7:32 PM #14790@ David, that is spot on, my idea is for the system to pinpoint the entries, manage risk and exits but we still need to find the trade setups on our own. For my part own part pay attention to H4 and H1 where the Coppock and MACD it starting to even out and shift from declining to inclining or vice versa and then wait for the CCI crossing the zero line with the two above as filters and then starting the system, another filter I have not mentioned much is that I use Heiken Ashi candles, the color of the most recently closed candle must match the intended trade direction. I do pay attention to the ADX too but I view it with more flexibility on higher timeframes since it tend too lag a bit too much, though if its value is very low the signal to start the system should be considered weaker.
@ Nicolas, that is a brilliant idea! I will start a new thread this weekend with explicit trade criteria and a checklist template to ensure that everyone posting about a trade opportunity has the same idea of what a good setup is and I will also be looking to modify Mike’s screeners.
Furthermore I made some minor modifications to the code, reducing the period in lines 49 and 53 from 7 to 3 for higher accuracy and also split the code into two sets of either long;
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687//-------------------------------------------------------------------------// Main code : LONG - Trend Chaser CCI//-------------------------------------------------------------------------/// Definition of code parametersdefparam preloadbars =10000DEFPARAM CumulateOrders = true // Cumulating positions deactivatedCOI= WEIGHTEDAVERAGE[210](ROC[165] +ROC[150])MAC= MACDline[180,390,135]CCC= CCI [60]AAA= ADX [14]once RRreached = 0accountbalance = 10000 //account balance in money at strategy startriskpercent = 2 //whole account risk in percent%amount = 1 //lot amount to open each traderr = 2 //risk reward ratio (set to 0 disable this function)sd = 0.25 //standard deviation of MA floating profit//dynamic step gridminSTEP = 10 //minimal step of the gridmaxSTEP = 50 //maximal step of the gridATRcurrentPeriod = 60 //recent volatility 'instant' periodATRhistoPeriod = 600 //historical volatility periodATR = averagetruerange[ATRcurrentPeriod]histoATR= highest[ATRhistoPeriod](ATR)resultMAX = MAX(minSTEP*pipsize,histoATR - ATR)resultMIN = MIN(resultMAX,maxSTEP*pipsize)gridstep = (resultMIN)// Conditions to enter long positionsc1 = (COI > COI[1])c2 = (COI > 0)c3 = (MAC > MAC[1])c4 = (MAC > 0)c5 = (CCC CROSSES OVER 0)c6 = (AAA > AAA[1])c7 = (AAA > 23)//first trade whatever conditionif NOT ONMARKET AND HIGHEST[3](c1)=1 AND HIGHEST[3](c2)=1 AND HIGHEST[3](c3)=1 AND HIGHEST[3](c4)=1 AND HIGHEST[3](c5)=1 AND HIGHEST[3](c6)=1 AND HIGHEST[3](c7)=1 AND STRATEGYPROFIT=0 then //close>close[1]BUY amount LOT AT MARKETendif// case BUY - add orders on the same trendif longonmarket and close-tradeprice(1)>=gridstep*pipsize thenBUY amount LOT AT MARKETendif//money managementliveaccountbalance = accountbalance+strategyprofitmoneyrisk = (liveaccountbalance*(riskpercent/100))if onmarket thenonepointvaluebasket = pointvalue*countofpositionmindistancetoclose =(moneyrisk/onepointvaluebasket)*pipsizeendif//floating profitfloatingprofit = (((close-positionprice)*pointvalue)*countofposition)/pipsize//actual trade gainsMAfloatingprofit = average[40](floatingprofit)BBfloatingprofit = MAfloatingprofit - std[40](MAfloatingprofit)*sd//floating profit risk reward checkif rr>0 and floatingprofit>moneyrisk*rr thenRRreached=1endif//stoploss trigger when risk reward ratio is not met alreadyif onmarket and RRreached=0 thenSELL AT positionprice-mindistancetoclose STOPendif//stoploss trigger when risk reward ratio has been reachedif onmarket and RRreached=1 thenif floatingprofit crosses under BBfloatingprofit thenSELL AT MARKETendifendif//resetting the risk reward reached variableif not onmarket thenRRreached = 0endifOr short;
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384/// Definition of code parametersdefparam preloadbars =10000DEFPARAM CumulateOrders = true // Cumulating positions deactivatedCOI= WEIGHTEDAVERAGE[210](ROC[165] +ROC[150])MAC= MACDline[180,390,135]CCC= CCI [60]AAA= ADX [14]once RRreached = 0accountbalance = 10000 //account balance in money at strategy startriskpercent = 2 //whole account risk in percent%amount = 1 //lot amount to open each traderr = 2 //risk reward ratio (set to 0 disable this function)sd = 0.25 //standard deviation of MA floating profit//dynamic step gridminSTEP = 10 //minimal step of the gridmaxSTEP = 50 //maximal step of the gridATRcurrentPeriod = 60 //recent volatility 'instant' periodATRhistoPeriod = 600 //historical volatility periodATR = averagetruerange[ATRcurrentPeriod]histoATR= highest[ATRhistoPeriod](ATR)resultMAX = MAX(minSTEP*pipsize,histoATR - ATR)resultMIN = MIN(resultMAX,maxSTEP*pipsize)gridstep = (resultMIN)// Conditions to enter short positionsc11 = (COI < COI[1])c12 = (COI < 0)c13 = (MAC < MAC[1])c14 = (MAC < 0)c15 = (CCC CROSSES UNDER 0)c16 = (AAA > AAA[1])c17 = (AAA > 23)//first trade whatever conditionif NOT ONMARKET AND HIGHEST[3](c11)=1 AND HIGHEST[3](c12)=1 AND HIGHEST[3](c13)=1 AND HIGHEST[3](c14)=1 AND HIGHEST[3](c15)=1 AND HIGHEST[3](c16)=1 AND HIGHEST[3](c17)=1 AND STRATEGYPROFIT=0 then //close<close[1]SELLSHORT amount LOT AT MARKETendif// case SELL - add orders on the same trendif shortonmarket and tradeprice(1)-close>=gridstep*pipsize thenSELLSHORT amount LOT AT MARKETendif//money managementliveaccountbalance = accountbalance+strategyprofitmoneyrisk = (liveaccountbalance*(riskpercent/100))if onmarket thenonepointvaluebasket = pointvalue*countofpositionmindistancetoclose =(moneyrisk/onepointvaluebasket)*pipsizeendif//floating profitfloatingprofit = (((close-positionprice)*pointvalue)*countofposition)/pipsize//actual trade gainsMAfloatingprofit = average[40](floatingprofit)BBfloatingprofit = MAfloatingprofit - std[40](MAfloatingprofit)*sd//floating profit risk reward checkif rr>0 and floatingprofit>moneyrisk*rr thenRRreached=1endif//stoploss trigger when risk reward ratio is not met alreadyif onmarket and RRreached=0 thenEXITSHORT AT positionprice-mindistancetoclose STOPendif//stoploss trigger when risk reward ratio has been reachedif onmarket and RRreached=1 thenif floatingprofit crosses under BBfloatingprofit thenEXITSHORT AT MARKETendifendif//resetting the risk reward reached variableif not onmarket thenRRreached = 0endifI’ll update everyone when the new thread is up and running 🙂
6 users thanked author for this post.
10/13/2016 at 9:42 AM #14813Note that the above code also has been updated to only run one cycle of trades after being stopped and will need to be started again manually as defined on line 43 and 40 respectively by “AND STRATEGYPROFIT=0”
@ Nicolas, I noticed an error in the Trend Chaser code, the max and min grid step works great for indices such as DAX and DOW but does not seem to work at all for FX pairs. For instance a ran a backtest on this night’s upmove on EURAUD with min step 10 and max step 50 but several entries where taken with just 1-3 steps in between, I thought this might be a decimal issue and increased the min and max step to 100 and 500 but I did not affect the distance between the entries, any idea what might be the problem?
10/13/2016 at 11:02 AM #14824Your settings (for 1 minute TF?) seems not good to give a real dynamic step. You should use this indicator instead to have a clear view of how it deals on chart before modifying the settings in the strategy code:
123456789101112131415//dynamic step gridminSTEP = 5 //minimal step of the gridmaxSTEP = 20 //maximal step of the gridATRcurrentPeriod = 5 //recent volatility 'instant' periodATRhistoPeriod = 100 //historical volatility periodATR = averagetruerange[ATRcurrentPeriod]histoATR= highest[ATRhistoPeriod](ATR)resultMAX = MAX(minSTEP*pipsize,histoATR - ATR)resultMIN = MIN(resultMAX,maxSTEP*pipsize)gridstep = (resultMIN)return gridstepResults given seems ok to me for forex pairs ..
10/13/2016 at 12:51 PM #14836@cfta Just so that I understand how you currently use the system: Do you scan H4 and H1 with Coppock, MACD, CCI and Heiken Ashi to find setup and when setup is there, as described above, you start the system on M1. If so do you use Mikes original settings for the indicators on H4 and H1? Is there any other parameter you change in the system dependant on what you trade?
Thanks to all in this thread:)
10/13/2016 at 3:55 PM #14858@ Nicolas
Sorry for not being very clear. Yes I ran the system on M1 and I also had it running live on my demo account on M1 overnight, I also forgot to mention that I have changed the ATR value to 60 and ATRhistory to 600. With the below code I got multiple entries 1-3 pips from another even though min step was set to 10 (the remaining code was the same as my last ones posted above):
12345678910111213141516171819202122232425262728/// Definition of code parametersdefparam preloadbars =10000DEFPARAM CumulateOrders = true // Cumulating positions deactivatedCOI= WEIGHTEDAVERAGE[210](ROC[165] +ROC[150])MAC= MACDline[180,390,135]CCC= CCI [60]AAA= ADX [14]once RRreached = 0accountbalance = 10000 //account balance in money at strategy startriskpercent = 2 //whole account risk in percent%amount = 1 //lot amount to open each traderr = 2 //risk reward ratio (set to 0 disable this function)sd = 0.25 //standard deviation of MA floating profit//dynamic step gridminSTEP = 10 //minimal step of the gridmaxSTEP = 50 //maximal step of the gridATRcurrentPeriod = 60 //recent volatility 'instant' periodATRhistoPeriod = 600 //historical volatility periodATR = averagetruerange[ATRcurrentPeriod]histoATR= highest[ATRhistoPeriod](ATR)resultMAX = MAX(minSTEP*pipsize,histoATR - ATR)resultMIN = MIN(resultMAX,maxSTEP*pipsize)gridstep = (resultMIN)I can’t seem to figure out the problem so please have another look if I have missed something or changed something unintentioanlly 🙂
@ Brage
Yes all in all that is correct, I screen manually with the indicators you mention and I also use Mike’s Bullish & Bearish screeners but I intend to modify them to include CCI instead of Stochastics and add ADX. When screening H4 & H1 I use the default values of the indicators except for CCI with value 12.
1 user thanked author for this post.
10/13/2016 at 7:44 PM #1486610/13/2016 at 7:48 PM #14869Apparently I feel creative today so I will share a trade I took today which reflects my intended use for system very well. So this morning on H1 I noticed the DOW approaching strong support just about the 18 000 level, MACD and Coppock had started to curve from declining towards inclining, the CCI was approaching zero but had not yet crossed (my largest flaw in trading is that I often enter too early when it looks like a signal is coming rather than wait for the signal to actually occur). So I placed a manual entry order on my account and started the system on the other account around 10:00 CET, the signal came later than expected and I had some unecessary drawdown due to my premature entry and some news volatility, it took all day but when the system kicked in during early evening the entry conditions were met and I exited manually moments ago with a nice 4.5 % profit. The beauty of the system is that when a setup is spotted it can be started and when there is a good entry the system will take even if it occurs several hours later 🙂
1 user thanked author for this post.
10/13/2016 at 8:33 PM #14875Hi Chap, welcome to the thread! Yeah the values for the Coppock and MACD are right but you should use a regular CCI instead of the divergence, note that I have changed the CCI to histogram instead of lines and the MACD – rather than MACD minus signal – to histogram as well since it shows the “curving” bette than the deafult settings.
1 user thanked author for this post.
10/13/2016 at 9:40 PM #14880Great explanation, I get the method completely now. Good trade this evening. What values are you using for DOW? I used the above long code as a test. Based on the hourly chart I think I would have started the system at at 17:00 during real market rather than spread bet and pulled it at 20:30, from the breakout code I use on the DOW, 20:30 seems to be the optimal time to finish. All seem about right / makes sense?!
This is UK Time, £1 pp btw.
10/14/2016 at 5:04 PM #14911@cfta Thanks for your explanation on how you find your triggers. Sorry for asking but what parameters do I need to change in the system if I want to run it on another index (Sweden30 for example). I tried it on the recent upmove with your trigger (startpoint yesterday 17:20) but I don´t get any buy with the system. Is it the gridsteps or something else? Tested on Dow as in your example and it looks as yours.
Happy friday!
10/16/2016 at 1:16 PM #14972Hi traders,
I have posted the new thread in the general discussion forum;
http://www.prorealcode.com/topic/grid-step-system-only-trades-and-setups/
Looking forward for us to share trades and opportunities 🙂
@ cosmic, for higher TF scanning I use default values, for M1 the values in the code.
@ Brage, I don’t think you need to change anything, maybe adjust your indicator settings on M1 to see the signals but there weren’t any on late Thursday or Friday since ADX was too low and when it wasn’t and CCI crossed Coppock and MACD didn’t match.
1 user thanked author for this post.
10/16/2016 at 2:11 PM #14974Cheers cfta.
Are you using the code in your post for 1 min here:
12345//dynamic step gridminSTEP = 10 //minimal step of the gridmaxSTEP = 50 //maximal step of the gridATRcurrentPeriod = 60 //recent volatility 'instant' periodATRhistoPeriod = 600 //historical volatility periodOr Nicolas’ suggestion here:
12345<span class="token comment" spellcheck="true">//dynamic step grid</span>minSTEP <span class="token operator">=</span> <span class="token number">5</span> <span class="token comment" spellcheck="true">//minimal step of the grid</span>maxSTEP <span class="token operator">=</span> <span class="token number">20</span> <span class="token comment" spellcheck="true">//maximal step of the grid</span>ATRcurrentPeriod <span class="token operator">=</span> <span class="token number">5</span> <span class="token comment" spellcheck="true">//recent volatility 'instant' period</span>ATRhistoPeriod <span class="token operator">=</span> <span class="token number">100</span> <span class="token comment" spellcheck="true">//historical volatility period</span> -
AuthorPosts
Find exclusive trading pro-tools on