NDQ mean reversion 5 min Strategy
Forums › ProRealTime English forum › ProOrder support › NDQ mean reversion 5 min Strategy
- This topic has 5 replies, 2 voices, and was last updated 1 year ago by robertogozzi.
-
-
03/02/2023 at 1:43 PM #210763
Hi crew,
Here I have taken a 1 min trade to a 5 min version that looks ok. It was a challenge to myself to create something with less limitations ie. time, hard stops etc. I cannot get it to run however and believe it’s to do with the MTF. I have used this feature to filter many trades but never had a problem.
I can have it in my live portfolio but does not execute or get rejected, can someone please take a look? It should be trading in this environment.
There is further work to be done on it’s entry, but for the most part seems ok.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849// Definition of code parametersDEFPARAM CumulateOrders = false // Cumulating positions deactivated// The system will cancel all pending orders and close all positions at 0:00. No new ones will be allowed until after the "FLATBEFORE" time.DEFPARAM Preloadbars = 10000//Read market strucuretimeframe (30 minute,updateonclose)indicator1 = ExponentialAverage[100]c1 = (close < indicator2[1])// Conditions to enter long positionstimeframe (default)c2 = (close < low[3])indicator2 = Average[1000](close)c3 = (indicator2 <= indicator2[100])c4= (close <= indicator2)Indicator3 = ExponentialAverage[10]Indicator4 = ExponentialAverage[20]c5 = (Indicator4 CROSSES OVER indicator3)Once MaxLoss = 50Once TempProfit = 0Once TradeON = 1If IntraDayBarIndex = 0 ThenTempProfit = StrategyProfitTradeON = 1EndifIf TempProfit - StrategyProfit >= MaxLoss thenTradeON = 0EndifIF c1 AND c2 AND c3 AND c4 AND c5 AND TradeOn THENBUY 1 CONTRACT AT MARKETENDIF// Conditions to exit long positionsindicator5 = ExponentialAverage[50](close)c6 = (close CROSSES Under indicator5[0])indicator6 = Volumec7 = (indicator6 < 2000[3]) //volume specific to current NDQ environment. Needs % version for robustnessc8 = (close < open[2]) //boosts profits!IF c6 OR c7 AND c8 THENSELL AT MARKETENDIF03/02/2023 at 6:07 PM #210782Line 10 should read:
1c1 = (close < indicator1[1]) //instead of c1 = (close < indicator2[1])and line 47 should read:
1IF OnMarket AND (c6 OR c7 AND c8) THEN1 user thanked author for this post.
03/03/2023 at 12:37 AM #210805Line 10 should read:
<!– Crayon Syntax Highlighter v_2.7.2_beta –>
<textarea class=”crayon-plain print-no” style=”tab-size: 4; font-size: 14px !important; line-height: 16px !important; z-index: 0; opacity: 0; overflow: hidden;” readonly=”readonly” wrap=”soft” data-settings=”dblclick”>c1 = (close < indicator1[1]) //instead of c1 = (close < indicator2[1])</textarea><table class=”crayon-table”>
<tbody>
<tr class=”crayon-row”>
<td class=”crayon-nums ” data-settings=”show”>1</td>
<td class=”crayon-code”>c1 <span class=”crayon-o”>=</span> (<span class=”crayon-st”>close</span> <span class=”crayon-o”><</span> indicator1<span class=”crayon-o”>[</span><span class=”crayon-cn”>1</span><span class=”crayon-o”>]</span>) <span class=”crayon-c”>//instead of c1 = (close < indicator2[1])</span></td>
</tr>
</tbody>
</table><!– [Format Time: 0.0002 seconds] –> and line 47 should read:
<!– Crayon Syntax Highlighter v_2.7.2_beta –>
<textarea class=”crayon-plain print-no” style=”tab-size: 4; font-size: 14px !important; line-height: 16px !important; z-index: 0; opacity: 0; overflow: hidden;” readonly=”readonly” wrap=”soft” data-settings=”dblclick”>IF OnMarket AND (c6 OR c7 AND c8) THEN</textarea><table class=”crayon-table”>
<tbody>
<tr class=”crayon-row”>
<td class=”crayon-nums ” data-settings=”show”>1</td>
<td class=”crayon-code”><span class=”crayon-st”>IF</span> <span class=”crayon-st”>OnMarket</span> <span class=”crayon-st”>AND</span> (c6 <span class=”crayon-st”>OR</span> c7 <span class=”crayon-st”>AND</span> c8) <span class=”crayon-st”>THEN</span></td>
</tr>
</tbody>
</table><!– [Format Time: 0.0002 seconds] –>
Thanks, and thanks for the MAX loss code I use it in everything and it has kept me safe.
I liked the back test results with the failed code much better!
Uh, back to the drawing board…I’ll poke around with it a bit longer. The 1 min version has been in profit for 6 months so I’m sure there is something in the concept of this counter trend trade.
03/03/2023 at 7:35 AM #210814The 30min TF filter is neither here nor there to be honest. If I code the bot correctly it’s for the bin.
Regards the Exit conditions of my inactive code (c6 OR c7 AND c8), without correct format of “IF OnMarket THEN” What exactly have I asked it to do?
Because it does something which makes it amazing = 10%DD and 60%WR, 50% Annualized. It goes ballistic in a ‘bear mrkt’ and holds itself in a grinding trend.
Be honest, is this fools gold? Anyone?
Cheers CC
File attached is incorrect code and what I thought I was building!
03/03/2023 at 9:01 AM #210821“IF OnMarket THEN” simply makes SELL (which means exit from a Long position) only IF ONMARKET, otherwise your code will end up BUYing in line 36, then SELLing immediately in line 48 before any position is even opened (and you will be returned empty reports).
1 user thanked author for this post.
03/03/2023 at 9:05 AM #210822Beear in mind that backtests are only based (and optimized for) the past. There’s no forecasting skill in it!
So, it’s wise to let any code run in autotradimg on a demo account for several months before letting it manage real money!
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on