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.
-
-
08/09/2016 at 8:53 PM #11461
ATR is used here only as a component of the calculation of the dynamic step grid. It’s not a part of any trading decision as you may know. We need to know how fast is the market to calculate the steps, the ATR is the best indicator for this purpose.
About your idea of an ADX matrix, since multi timeframe is still not available, the best we could do would be to use multiple of periods to determine longer timeframe trends. A new thread about this would be great 👌
08/13/2016 at 1:19 AM #11641Nicolas, cfta and the many other contributors, this is one helluva good system – many thanks to all.
I have been testing the latest code from cfta with the ROUND removed as per Nicolas suggestion but without the other changes. So I ran cfta and Nicolas’ full code, one after the other on the same chart with an interesting result. I have attached the results.
The difference was that the code from cfta stopped automatically with a higher profit, while Nicolas’ code did not stop until the close of the markets. I did not synchronise the settings, which probably explains it. However, I find that with a lot of tests of cfta’s code, the trades are closed at a loss, either because the stop is too late and the market has turned, or the stop doesn’t activate at all. I have attached the various results.
I am afraid my PRT coding skills are near zero. However I have attempted to unravel the code to understand how it works, but to no avail. It seems that it is important to start the code at the right time, and hope that there is a long trend ahead. Shorter trends are the problem. Perhaps a stop driven by an indicator such as the Coppock in combination with the MACD.
I find the at a reasonably reliable entry is also indicated by these to two in conjunction. I posted a scanner some time ago using them in conjunction with the Stochastic. I have traded live with these and had reasonable success: about 50% win rate but a profit ratio of 3:1. I feel that the current code under discussion, driven by these could produce better results.
It would be ideal if this could be further developed into an AutoTrader.
08/13/2016 at 1:52 AM #11645Gentlemen, After further research, I have found that the removal of the code “pipsize” from the following instruction make a huge difference to the out come of a test over the same instrument and the same time period, using cfta’s code.
“// case SELL – add orders on the same trend
if shortonmarket and tradeprice(1)-close>=gridstep*pipsize then
SELLSHORT amount LOT AT MARKET
endif”I have attached the two results. Would love to know what is happening.
08/14/2016 at 2:03 PM #11674Thanks Mike for your investigation and research about this method.
I’m not gonna make a long answer to your interesting messages, cause I’m currently on leave 🙂
About the “pipsize”, it’s needed to convert the gridstep variable to the current instrument and to be compatible with any other ones with the same code. For AUDUSD, gridstep=10 means that new order will be launched each 0.0010 price difference between previous order and the current price or 10.0 points for the DAX/GER30 for example.
1 user thanked author for this post.
08/14/2016 at 7:29 PM #11702Welcome to the thread Mike!
Thanks for your testing and sharing your ideas, the current version of the system indeed requires a very high accuracy of timing when to start the system and one or two additional filters may prove very useful, I tried your screener a few months ago but couldn’t make it work for me, probably due to some mistake I did but I like it and will be happy to look into incoporating it into the system.
I’m currently trying different settings for the dynamic step grid which will hopefully improve the profits by taking very few entries when the market is ranging or is lacking the strenght to take off in either direction with max grid step at 50 but I might go even higher and then stack them up when the price is trending. Also keep in mind that that we can adjust the exit not only by the risk percent and RR at which the BB exit kicks in but also the MAfloatingprofit (line 43 in the code I posted on the previos page), if stops are premature increase the value or decrease it if stops are to early. Sometimes I exit manually instead if I sense a turnaround in the market, the BB exit is supposed to act primarily as a break even savior or to let a strong move play out all the way until it turns when not able to monitor the market.
Keep on testing I look forward to hearing more from you Mike 🙂
1 user thanked author for this post.
08/14/2016 at 10:14 PM #1170308/17/2016 at 11:34 PM #11800cfta et al, the answer to the stop loss may be to use the optimiser to establish a “ball-park” and then run it live on a strong entry signal. For example, I found that the optimal parameters for risk % and risk/reward were both 5 for the FTSE on a 5 minute chart. The test resulted in a 27% gain over 3 days before it stopped out. The results are attached.
Next step will be to run it forward under ProOrder starting with a strong entry signal. I will try the confluence of the COI, MACD and STO as per the screener I posted earlier.
08/18/2016 at 5:29 AM #1180508/18/2016 at 8:32 PM #11855Great stuff Mike, any setup which is able to reach 27 % profit during a normal market move in a matter of days is terrific. I would say that optimal risk % and RR % differs from one asset to another and is likely to change with volatility and market sentiment but it is still good to have a default value to start from.
Which settings did you use for minStep and maxStep and also which ATR periods. Please post the top 15 lines of the code to make it easier to follow since I expect we will post a handful of different settings going forward. I suppose you traded full lots on that 10k account?
This week I have been focusing on optimizing the ATR periods for the grid step, mainly for intraday trades being able to grab 3-5 % in a matter of hours when timing the start right, also looking into how the mentioned ADX matrix indicator can be developed.
08/26/2016 at 5:28 AM #12230Hi cfta,
I haven’t been changing the minStep and maxStep from your settings. I have been mainly working on optimising the rr, rp and STD, being the main inputs into the stop loss. However I have hit the wall as I can’t get the system to go past one trade. I would like to incorporate my Trend Chaser system into yours so that it could be set up as a ProOrder automatic trading system. I have attached the code I have been testing without much success. Perhaps you can see the problem.
As you will see, the TC works well but when I run the same code with money management, it is quite the opposite.
Your work is very interesting. I suppose that if you are trading manually, the ADX might provide an excellent entry point.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109/// Definition of code parametersdefparam preloadbars = 3000DEFPARAM CumulateOrders = false // Cumulating positions deactivatedCOI= WEIGHTEDAVERAGE[14](ROC[11] +ROC[10])MAC= MACDline[12,26,9]STO = Stochastic[14,5]once RRreached = 0accountbalance = 10000 //account balance in money at strategy startriskpercent = 1 //whole account risk in percent%amount = 1 //lot amount to open each traderr =rr //risk reward ratio (set to 0 disable this function)//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)// Conditions to enter long positionsc1 = (COI > COI[1])c2 = (MAC > MAC[1])c3 = (STO > 20)c4 = (STO < 40)c5 = (STO > STO[1])// Conditions to enter short positionsc11 = (COI< COI[1])c12 = (MAC< MAC[1])c13 = (STO < 80)c14 = (STO > 60)c15 = (STO < STO[1])//first trade whatever conditionif NOT ONMARKET AND HIGHEST[5](c1)=1 AND HIGHEST[5](c2)=1 AND HIGHEST[5](c3)=1 AND HIGHEST[5](c4)=1 AND HIGHEST[5](c5)=1 AND STRATEGYPROFIT=0 then //close>close[1]BUY amount LOT AT MARKETendifif NOT ONMARKET AND HIGHEST[5](c11)=1 AND HIGHEST[5](c12)=1 AND HIGHEST[5](c13)=1 AND HIGHEST[5](c14)=1 AND HIGHEST[5](c15)=1 AND STRATEGYPROFIT=0 then //close<close[1]SELLSHORT amount LOT AT MARKETendif// case BUY - add orders on the same trendif longonmarket and close-tradeprice(1)>=gridstep*pipsize thenBUY 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[20](floatingprofit)BBfloatingprofit = MAfloatingprofit - std[20](MAfloatingprofit)*sd//floating profit risk reward checkif rr>0 and floatingprofit>moneyrisk*rr thenRRreached=1endif//GRAPH floatingprofit as "float"//GRAPH RRreached as "rr"GRAPH floatingprofit as "floating profit"GRAPH BBfloatingprofit as "BB Floating Profit"//GRAPH positionprice-mindistancetoclose//GRAPH moneyrisk//GRAPH onepointvaluebasket//GRAPH gridstep//stoploss trigger when risk reward ratio is not met alreadyif onmarket and RRreached=0 thenSELL AT positionprice-mindistancetoclose STOPEXITSHORT AT positionprice-mindistancetoclose STOPendif//stoploss trigger when risk reward ratio has been reachedif onmarket and RRreached=1 thenif floatingprofit crosses under BBfloatingprofit thenSELL AT MARKETEXITSHORT AT MARKETendif//SELL AT positionprice-mindistancetoclose STOP//EXITSHORT AT positionprice-mindistancetoclose STOPendif//resetting the risk reward reached variableif not onmarket thenRRreached = 0endif08/26/2016 at 7:44 AM #12235Mike, you have to remove the
1<span class="token keyword">AND</span> <span class="token keyword">STRATEGYPROFIT</span><span class="token operator">=</span><span class="token number">0</span>at lines 42 and 46, otherwise, after the first trade, you will not get any new trade because the strategy profit has increase or decrease from 0.
1 user thanked author for this post.
08/27/2016 at 8:31 AM #12270Nicolas, cfta and others following this thread, I have combined the money management of this idea with my three indicator entry idea I posted as Trend Chaser 2.0. I have now started a new Library post, subject to Nicolas’ review, “Trend Chaser 3.0 with Money Management”. I hope this will start a flow of ideas for the further development of cfta’s original idea into an automatic system.
I am driven by the fact that all the market action happens on the other side of the planet while I sleep in Australia.
*edit by Nicolas: http://www.prorealcode.com/prorealtime-trading-strategies/trend-chaser-3-0-money-management/
3 users thanked author for this post.
08/28/2016 at 8:31 PM #12344Mike and fellows, very interesting progress indeed! I love the idea of the Trend Chaser, just the sort of thing we need to take it to the next level 🙂
I’m currently in the process of moving to a new home which is why I have been very active here recently and I won’t be for the next week but then I can hopefully get back on the testing and developing. As for the ADX matrix I will give everyone a brief preview. The idea originates from a Metatrader indicator which measures five ADX values, 7, 14, 21, 42 and 144 with one set of each on m1, m5, m15, h1, h4, d1, w1, in my opion the d1 and w1 and excessive and since PRT doesn’t support multiple timeframes yet we need multiply the values accordingly to get the right values. Given that we run the indicator on a m1 chart we want for instance for the m15 five values of 105, 210, 315, 630 and 2160. The matrix displays four colors, dark blue for strong up trend, light blue for weak uptrend, light red for weak downtrend and dark red for strong downtrend. When all values show either dark red or dark blue we usually have a great trade coming up if entering shortly after the colors changing. Basically we need 25 ADX values combined in one indicator and then display it in a logical manner… Any ideas?
08/28/2016 at 9:56 PM #1235009/26/2016 at 6:58 PM #13769Hey fellows,
So after weeks of hassles with boxes I’m set in a new home and returning to living a normal life with some awesome trading developement. I have not made any notable progress on how to create the above mentioned ADX indicator though I have been testing Mike’s Trend Chaser and it seems very well suited for this system.
My focus has been on optimizing the periods to run it on low TFs for higher entry accuracy, such as on the 10 second TF, but still catching larger moves by setting the Coppock Curve which is the major trend indicator to match a higher TF, such as H1, by multiplying each value by 360, and adapt the MACD to M15 by multiplying the values by 90 and set the Stochastic to match M5. This great set of filters can possible be enhanced by a single ADX to measure the strenght of the move in order to stay out of weak ranging moves.
How is everyone else doing with the system? In particular when it comes to setting profitable values for the dynamic step grid and ATR values?
More updates to come later this week…
-
AuthorPosts
Find exclusive trading pro-tools on