Mar
20

Formula 301 – #8 Compress Series Trading System

NeoTicker trading system fire orders after bar completion, this limition is done to emulate real-time condition when a signal is only confirmed after a bar is completed. However when signal indicators are based on higher time frames (e.g. 15 minutes, 30 minutes and etc.), this order placement method suffer when order placed at next bar could be 15 to 30 minutes after signal bar, compress series in NeoTicker can be used to compensate for this deficiency and make trading systems enter with acturate prices and fills.

Trading system with signals that generated from high time frame written on lower time frame data series will have more accurate entry and exit prices.

RSI momentum system is a system built using NeoTicker formula language, it has signals based on 15 minute time frame and trades executed on 1 minute time frame.

The code are as follow, I will provide some detail description of logic within.

Indicator Script

line 1: use compresseries function call to make a higher time frame series (i.e. 15 minute) .

line 3: comparison make with previous higher time frame bar number, this comparison is done in lower time farme to determine completion of a higher time frame bar.

line 5-7: create indicator with compressed higher time frame series, makeindicator calls are necessary to get correct result for higher time farme indicators.

line 10-16: determine when higher time frame signal line crossabove and below over bought and above over sold lines.

Note: Normal cross indicators cannot be used here because indicators values comparison are made between two nonsequenced end points which are end of current and previous higher time frame bars, all other lower time frame indicator result in between these two points are to be ignored.

In the case of current example, indicator calculation result are to be take at just completed 15 minute bar (i.e. RSIsignal(1) RSIsignal from 1 minute ago) and indictor result (i.e. $HTFPrevSignal) from previously completed 15 minute bar, which is saved at different point in indicator code.

line 18: use intimerange function to limit trading time from 10 in the morning to 4 in the afternoon.

line 20-38: long and short trade functions to fire off trades according to signals and conditions.

Note: Extra condition is inserted (i.e. $prevpostbar<>htf.barsnum(0)), to made sure trade signals are only taken once for one higher time frame bar, $prevpostbar stored value of higher time frame bar number of previous entry signals.

line 40: print out current equity of this system.

Note: Trading system UI checkbox under indicator setup must be checked in order for formula trade functions to work.

line 42: save current 15 minute RSI signal value for later crossover comparison use, change this value on every new 15 minute bars.

line 43: save current higher time frame bar number for comparison to determine completion of high time frame bar.

line 44: save current higher time frame bar number, this number is use to determine if current higher time frame signal has already been traded.

Chart below is RSI Momemtum system apply on a 1 minute chart, I have added a 15 minute data series and with RSI momentum indicator calculation based on 15 minute data to show that trades matched with signal from higher time frame.

RSI Momentum chart

Click here to download the trading system script.

Blog Developed
By ContentRobot