Trading system template
Forums › ProRealTime English forum › ProOrder support › Trading system template
- This topic has 23 replies, 5 voices, and was last updated 2 years ago by
Kev Monaghan.
-
-
01/25/2022 at 11:44 PM #186632
I started going through the system using your approach and right away found an outlier which would have eventually resulted in catastrophic loss or atleast many full hard stops taken out, the cause was my exit 2 was badly coded, I can see this is going to be a really helpful systematic approach to building my systems over time.
01/26/2022 at 9:07 AM #186640Hi Kev Monaghan, Great article, some really interesting ideas which intrigue and encourage further deliberation and testing. Thank you for sharing, much appreciated.
04/10/2022 at 10:50 AM #191511I am curious how do you feel about automating on 1 min time frame?
Well, I could be about the only one in this community using a 1 second TimeFrame, but which is Forex. Personally I wouldn’t even be able to use longer timeframes, just because I wouldn’t be able to find the entries (with Forex), which I now find by technical means. Otherwise, and as I told before, I try to work quite exactly the same as you, but as told that doesn’t work out mostly (my code is fully stuffed with all such attempts).
Otherwise, the advantage I seem to have is the fact (?) that the Strategies I have are winning, so all it requires is adding new ideas and see whether they work out for the better. This is the most convenient …
And, without much exception you will find everybody in here having difficulties with the shorter timeframes; it was a discussion only a few weeks back.
again) is that the peak you see on the 14th is actually traded off with more gain after it. And yes, it will be hard to believe that such things can be done, but this is how things work out when one sort of thinks like you do. The mechanism is always the attempt to diminish the subsequent losses (and it will be easy to understand how they will create the dips). That mechanism is just a workable one (I mean, one can deal with that) – as long as it does not go by optimisation. An easy to understand (and known) example is to skip a trade (coding such a thing may not be for everyone). Two losses after all ? then apply something else again._________
Edit: reformatted by moderation, please use the ” icon in toolbar to unquote text during your 5mn edit window when it has been misplaced inside a quote, thanks
Hi Peter, I started working on trying to code a london reversal/london momentum system for NQ
At the moment it is drawing down a bit to much so I am looking to get in lower with a 2nd entry and cut the bad entries better, I have been working on a price action signal/Indicator to use later based on Al brooks price action, but then again computer don’t care about drawdown,
I have set max risk as a stop loss for 35% of equity but it is only hard stop.
I also want to let the winners run a bit longer when they have potential or use the original main entry to trigger other sub systems.
I am trying to trade based on a signal I see often on London open on NQ where the market ussually initiates a sustained momentum move.
I can only backtest 100k candles, this is my latest base version, I have another original base version that gets good results on forex pairs that are in bulltrend but I forgot to check if this version is the same.
The tf indicator was my first attempt at coding it is not doing anything but it is just the rsi.
I started from 15min signal and after testing for positive results I dropped down to 3min charts to get more specific with entries and exits
My goal as I said is to work with this signal in as many ways as possible, this is just a rough attempt at isolating a usable pattern.
3min charts NQ or MNQ I used 6/22ALL, starting capital 10k.
I will probably try to make it wait to buy a flush when I am finished my price action indicator.
04/11/2022 at 2:55 AM #191545Good morning there, Kev. I assumed a 3 minute chart, because this is what you mention in between the lines. Notice the difference (for result) with a 1 minute chart, despite the TimeFrame in the code remains the same (3 minute).
Either way it is touch to see through what it should do, although we have your description. IMHO it is not working out really, at least not with not all technically working out, as how I see it.In the Editor window you should engage Tick by Tick mode (checkbox in the right pane of the main Editor screen).
In the same window you set the spread to be 0.5. I think it should be 2 (though 1 will often do as well).
The trading times in your code are ambiguous for me because I don’t know what time zone you exactly set. It occurs to me that for me they need to be one hour earlier (Amsterdam time instead of London time). Thus, start to be active at 30 minutes before opening of the USA stock market, deactivate at 15 minutes into it. Again, I must just guess this.
Your midnight deactivation (the means to do it) is a bit beyond me – but this can be because I can’t know your thoughts. Anyway, it that would be my time 00:00. All combines with it not working anyway because trades are taken throughout. This is caused by this :
123456//RESET CONDITIONS TO 0 AT END OF SESSION//IF TIME CROSSES OVER 230000 THEN//IF TIME CROSSES OVER 240000 THEN // 10-04-2022,PS. But this does not work out to what's intended.IF TIME >= 0 THEN // 10-04-2022,PS. This does.WATCHING = 0ENDIF… with next the question what your “end of the session” means. To me that would be 22:00 my time, or 21:00 London time for the stock market. For the Nasdaq it would be 23:00 my time, 22:00 London.
You have another of such “cross over” in there, which also requires changing like you see above.Because of Daylight Savings (active now in the USA for 4 weeks (I did not count really)), things won’t work out at all, also not because over here we’re into that 2 weeks less. And because your whole strategy seems to be hooked up to the opening (which idea is fine), nothing will work out really.
Be careful with the end of the trading, would that be 14:45 your time. I mean, that first 15 minutes is indeed totally crucial, but since your steps are 3 minutes, that may not turn out as you want. Thus, would you like to make 14:46 of that, it does not work out with the 3 minute chart (it’s either 14:45 or 14:48 in that case).
I only see just now that all the trades last one bar only. So this seems wrong to me in the first place. I hope that is not my fault.
All ‘n all in the results I see a kind of random trades and this can’t be the intention. Below you see it for the 1 minute chart 90K bars, hence the past 3 months.
I hope this is the kind of response you were asking for, as I did not see questions really. But it should get you going better ? I hope so !
04/11/2022 at 3:44 AM #191548”
I hope this is the kind of response you were asking for, as I did not see questions really. But it should get you going better ? I hope so !”
sorry peter my charts are set to +10 GMT Brisbane, Australia; the strategy is coded to that time.
it is supposed to start ‘watching’ for a 15min signal that has a 60% probability at 1700 +10GMT; the London stock exchange open onwards until USA premarket.
It appears I accidently started the strategy earlier however, 1600 is the time I start watching for algorithms to move the market prior to london open.
as for the entries, they are not currently how I want them but i am working on an automated system for this and trade management as i would do manually.
I have stepped down to 3min to try and get the most out of the time window but i will apply some changes as you suggest.
at the moment some trades drawdown 100% of return so i am looking to fix this but here are the results from my time zone
attached are my results and equity curve of 2x base versions.
I will look over you comments and change some code; as for below; this is how I am keeping my original signal for recycling more setups, however right now I only have the one entry later i will initiate intraday trend trades etc from this signal to run winners further. I didn’t have many questions this time I just figured you would have good opinions as always, thankyou.
start watching after high probability long setup trigger12345//WATCHING THE ORIGINAL SIGNAL FOR MULTIPLE SETUPSONCE WATCHING=0IF TIME > 160000 AND TIME <164500 AND CLOSE CROSSES OVER HIGH[1] THEN// AND TF<50 THEN //MAKES STRATEGY WIN 100%WATCHING=1ENDIF04/11/2022 at 12:55 PM #191576I just figured you would have good opinions
All right Kev.
Because there’s no way I can mimic your results, I figured that you’re doing this on PRT-IB (not PRT-IG). I mean, the ticker sure looks like that.
So my next good opinion could be : No AutoTrading with PRT-IB so far …🙁
?PS: What is actually the investment you think you are doing ? it is not $5000 … It should be 284K, assumed PRT-IB indeed (no fractions on the contract quantity possible that I know of).
There are so many things not working out, that it looks like you posted another code. The changed times help, but it is still not clear to me how *I* need to set them and Daylight Savings-changes are still in order for the period of back testing. Not that I per se want to get this going, but is is too much out of here to see such differences.04/11/2022 at 1:14 PM #191577I just figured you would have good opinions
All right Kev.
Because there’s no way I can mimic your results, I figured that you’re doing this on PRT-IB (not PRT-IG). I mean, the ticker sure looks like that.
So my next good opinion could be : No AutoTrading with PRT-IB so far …
🙁
?
PS: What is actually the investment you think you are doing ? it is not $5000 … It should be 284K, assumed PRT-IB indeed (no fractions on the contract quantity possible that I know of).
There are so many things not working out, that it looks like you posted another code. The changed times help, but it is still not clear to me how *I* need to set them and Daylight Savings-changes are still in order for the period of back testing. Not that I per se want to get this going, but is is too much out of here to see such differences.”
Yes this is for IB, I was not aware they do not allow Auto trading, I normally use IG CFDs, which I haven’t tested this on yet.
I am also working on learning C# because I am a bit limited by brokers as an Australian so I can not get the intraday margins on PRT at the moment but I have funding on another platform so if I can get things working here I can convert code to C#
my backtest starts at 9th feb 2022, I can not test back further on 3 min charts also as you said daylight savings has moved time zones recently so if you test 1 million candles this will be a problem especially if my system is not good :).
below is the simplified version of my code, the otehr version is not fully utilised yet, much of it is for later stages.
simplified12345678910111213141516171819202122232425262728293031323334353637Inprofit = Close[1] > Positionprice+(RANGE[tradeindex[1]]*0.5)// Conditions to enter long positionsST = Supertrend[1.5,100]ATR = AverageTrueRange[6](close)EMA8 = ExponentialAverage[8](close)// STARTS WATCHING FOR SETUPS FROM HIGH PROBABILITY TRIGGERONCE WATCHING = 0IF TIME > 160000 AND TIME <164500 AND CLOSE CROSSES OVER HIGH[1] THENWATCHING = 1ENDIF// MAIN ENTRY CONDITIONE1 = WATCHING = 1 AND CLOSE CROSSES OVER HIGH[2] AND TIME<164500IF NOT LONGONMARKET AND E1 THENBUY 1 CONTRACTS ROUNDEDUP AT EMA8+0.25 LIMITENDIF//MAIN ENRTY EXITSEX1 = TIME CROSSES OVER 003000 AND NOT INPROFITEX2 = INPROFIT AND RANGE CROSSES OVER ATR*1.5 AND CLOSE > STIF LONGONMARKET AND EX1 OR EX2 THENSELL AT MARKETENDIF//HARD STOP LOSSSET STOP $LOSS (5000+STRATEGYPROFIT)*0.35//RESET CONDITIONS TO 0 AT END OF SESSIONIF TIME CROSSES OVER 230000 THENWATCHING = 0ENDIFhere is the original test that i gave you; i will upload both from version I just tested.
TEST12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576DEFPARAM CUMULATEORDERS = TRUETIMEFRAME(3MN)//THIS STRATEGY REQUIRES A 'guaranteed' STOP LOSS//Requires atleast 5k starting capitalSTARTINGCAPITAL = 5000 //TESTED CAPITAL: USE 2x or 3x to start strategy to account for outliersRISKSCALE = 5000// $ AMOUNT OF EQUITY REQUIRED TO TRADE 1 CONTRACTPOSITIONSIZING = (STARTINGCAPITAL+STRATEGYPROFIT)/RISKSCALE //NUMBER OF CONTRACTS TRADED BASED ON EQUITY AND RISKEXPONETIALRISKLIMIT = 0.5// PERCENT OF EQUITY TO RISK PER ENTRY: STOP LOSS = (LOSSLIMIT/RISKADJUST)*EXPONETIALRISKLIMIT = (TOTALEQUITY/TRADESIZE)*EXPONENTIALRISKLIMT EG (2000/2)*0.025 SETS STOPLOSS AT 25 POINTS OR $1000R = 2 //RISK ADJUSTMENT FOR MAX CONTRACT VALUE BEFORE AUTO SCALING DOWN RISK INITIATES//SELF SCALING CAPITAL PROTECTION / ADJUST TO SCALE DOWN RISK AS PROFIT ACCUMULATERISKADJUST = POSITIONSIZINGIF POSITIONSIZING => R THENRISKADJUST = POSITIONSIZING*0.5IF POSITIONSIZING => R*5 THENRISKADJUST = POSITIONSIZING*0.25IF POSITIONSIZING => R*10 THENRISKADJUST = POSITIONSIZING*0.1IF POSITIONSIZING => R*20 THENRISKADJUST = POSITIONSIZING*0.05IF POSITIONSIZING => R*50 THENRISKADJUST = POSITIONSIZING*0.025ENDIFENDIFENDIFENDIFENDIF//SYSTEM EQUITY CHECK // ADJUST FOR TOTAL AMOUNT OF EQUITY TO RISK ON THIS SYSTEMLOSSLIMIT = STRATEGYPROFIT + STARTINGCAPITALIF LOSSLIMIT>0 THENSYSTEMPOSITIVE=1ELSIF LOSSLIMIT=<0 THENSYSTEMPOSITIVE=0ENDIFPROFITABLESTRATEGY = SYSTEMPOSITIVE=>1 // CONDITION TO ONLY TRADE WHEN SYSTEM HAS NEUTRAL TO POSITIVE EQUITYFULLSIZE = COUNTOFPOSITION => RISKADJUST[TRADEINDEX(1)]// USED TO PREVENT SCALING DOWN TO MUCH TO EARLY //NOT USED CURRENTLYADDSIZE = RISKADJUST - COUNTOFPOSITION //SIZE USED TO CALCULATE ADDS IN LINE WITH RISK RATIOCOP50 = Countofposition*0.5Inprofit = Close[1] > Positionprice+(RANGE[tradeindex[1]]*0.5)// Conditions to enter long positionsTIMEFRAME(3MN)ST = Supertrend[1.5,100]ATR = AverageTrueRange[6](close)tf = CALL "trendf"EMA8 = ExponentialAverage[8](close)EMA13 = ExponentialAverage[13](close)//WATCHING THE ORIGINAL SIGNAL FOR MULTIPLE SETUPSONCE WATCHING=0IF TIME > 160000 AND TIME <164500 AND CLOSE CROSSES OVER HIGH[1] THEN// AND TF<50 THEN //MAKES STRATEGY WIN 100%WATCHING=1ENDIF// MAIN SETUPE1 = WATCHING=1 AND CLOSE CROSSES OVER HIGH[2] AND TIME<164500IF NOT LONGONMARKET AND E1 AND NOT FULLSIZE THENBUY RISKADJUST CONTRACTS ROUNDEDUP AT EMA8+0.25 LIMITENDIF//HARD STOP FAILSAFESET STOP $LOSS (STARTINGCAPITAL+STRATEGYPROFIT)*EXPONETIALRISKLIMIT//RESET CONDITIONS AT END OF SESSIONIF TIME CROSSES OVER 230000 THENWATCHING=0ENDIFI am not sure what else could be going on, I will probably try to test this on IG markets cfd during the week as I have a very high leverage account with them but I haven’t used it in some time, I don’t plan on running live for a long time, at this stage algorithmic trading is just for fun and my manual trading is more serious.
04/12/2022 at 12:03 AM #191608I will probably turn the entry into a box breakout of the post asia pre europe range; at the moment it is just an interesting statistic that you can get a very high win rate with a reasonable drawdown 1 to 1 drawdown but obviously needing a lot of work to make a viable system an eliminate drawdown where possible.
04/12/2022 at 1:30 AM #191613My box idea worked, I wont share exact method so as to protect my liquidity but if anyone is interested I used a time box.
-
AuthorPosts
Find exclusive trading pro-tools on