Here is the first prototype from Marketcalls which demonstrates multi-timeframe based trading system which compares two timeframes (5min and hourly in this case) and takes a trade decision based on both the timeframes. To demonstrate with simple example we used supertrend on 5min timeframe and Hull RSI on the hourly timeframe to filter unwanted trading signals.

**Trading Logic**

Go long if Hourly HRSI is trending upwards and Supertrend turns to buy mode on 5min charts

Exit long if Supertrend turns to sell mode (i.e Trailing Stop hits on closing basis) on 5min charts

Go Short if Hourly HRSI is trending downwards and Supertrend turns to short mode on 5min charts

Exit Short if Supertrend turns to sell mode (i.e Training Stop hits on closing basis) on 5min charts

**Bank Nifty Futures showing Supertrend Along with Hourly HRSI indicator as a filter**

Download Supertrend with Multitimeframe Filter – Amibroker AFL Code

Here is the backtested results for Bank Nifty Futures (5min charts) Since SEP 2010 onwards with Brokerage + Other Transaction costs added as 0.02%

Max open position is taken based on 15% of the available capital.

**Equity Curve**

**Download the Backtest Result**

Is this the best intraday trading system. If ‘No’ then what is the best trading system you like the most.

Is your back test only on long side?

Its not a intraday trading system. For Intraday trading system visit http://www.marketcalls.in/lintra

Backtest provided is for both long and short.

PARAMSETENGINE() shows error

May be SPSO Optimizer is not installed in your machine. Either Install the SPSO optimizer or remove those three lines of code from your afl.

OptimizerSetEngine(“spso”);

OptimizerSetOption(“Runs”, 1 );

OptimizerSetOption(“MaxEval”, 500 );

how to add this SPSO Optimizer?

HI,

paramrSetEngine(“spso”);

paramrSetOption(“Runs”, 1 );

paramrSetOption(“MaxEval”, 500 );

is giving error.

i use licensed Ami 6.20.1

Thanks.

May be SPSO Optimizer is not installed in your machine. Either Install the SPSO optimizer or remove those three lines of code from your afl.

showing error in these lines

paramrSetEngine(“spso”);

paramrSetOption(“Runs”, 1 );

paramrSetOption(“MaxEval”, 500 );

Hi

I have try to use the above-mentioned afl codes but got following error

Multi Supertrend V3.0 :

_N(Title = StrFormat(“{{NAME}} – {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}”, O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

paramrSetEngine(“spso”)

———————^

File: ‘Formulas\Drag-drop\Multi Supertrend V3.0. 2.afi’, Ln:52, Col:23

Error 30.

Syntax error, identifier ‘paramrsetengine’ is undefined.

Use ‘Edit Formula’ to correct error”

Now what should I do to correctly apply these codes?

Thanks and regards

What Version you are using as SPSO is a optimizer engine plugin which released post 5.7 onwards. May be if you are using older codes you may need to

remove the optimizer blocks i.e the below lines from the code and try out.

OptimizerSetEngine(“spso”);

OptimizerSetOption(“Runs”, 1 );

OptimizerSetOption(“MaxEval”, 500 );

Hi Rajandran,

I appreciate you do provide Super trend afl code for every new version,

but why dont you provide code for back testing and back testing setup.

Could you please share us the link for Lintra and its backtesting code and setup

All the AFL trading system which i provided here supports backtesting. And you can backtesting on your own.

When comes to lintra its not open source but system is open to use http://www.marketcalls.in/lintra and also available as free addon for

nimbledataprolite subscribers who subscribe via marketcalls http://www.marketcalls.in/premium/globaldatafeeds/nimbledatapropluslite

For backtesting and learning about lintra try this webinar http://www.marketcalls.in/workshop/webinar-lintra-intraday-trading-system-system-performance.html

I want Supertrend formula in Excel, pls. guide how to do it

Thanks a lot.

Hi Rajandran,

I am very big fan of you,to such kind give strategies and i have many time try to talk you but your team not touch you and I have also mail you.please check e-mail and answer me.

Could some one explain the values of the below 2 lines

Factor=param(“Factor”,3,1,4,1);

Pd=param(“ATR Periods”,14,1,50,1);

I understood 3 is multiplier and 14 is ATR

but what about 1,4,1 and 1,50,1

Those are values you can change the FActor and ATR from the external properties box.

Hi Rajandran,

I was wondering if you could help me with a bit of Amibroker formula please. In the following example I want to explore and find any stocks where “MyF()” condition is true if x is equal to 10,11,12,13,14,15,16 and so on. Perhaps I want to check 100 different periods.

The code works fine and if MyF(10) is true then the explorer “DayDivG” column will show “10”, if MyF(11) is true then the explorer “DayDivG” column will show “11”, and so on.

My Question is (if you have the time) is there an easier way to write the formula than having to use multiple OR expressions and IIF functions?

If you could show an example I would greatly appreciate it.

Many thanks for your great website and very helpful Amibroker lessons.

///////////////////////////////////////////////////////

MDHist = MACD() – Signal();

function MyF(x)

{

PD = L < Ref(LLV(L,x),-1) AND Ref(L,-x) < Ref(L,-x + 1) AND Ref(L,-x) Ref(MDhist,-x) AND MDHist < 0 AND Ref(MDHist,-x) < 0;

DivG = PD AND MDHU ;

Return DivG;

}

Setup = MyF(10) OR MyF(11) OR MyF(12) OR Myf(13) OR Myf(14) OR MyF(15) OR MyF(16);

AddColumn(IIf(MyF(10),10,IIf(MyF(11),11,IIf(MyF(12),12,IIf(MyF(13),13,

IIf(MyF(14),14,IIf(MyF(15),15,IIf(MyF(16),16,0))))))),"#DivG");

Filter = Setup;

///////////////////////////////////////////

Do you provide any AUM services for retail clients?? I am interested in investing with you…

How can the trading logic for LX (Long Exit) and SX (Short Exit) be same?

How do you backtest contractwise data on Amibroker in the absence of continuous data ,is there a way to stitch the data or is there anything else that can be done,please advice

Hi Rajendran,

Nice example of multi time frame code. Though it is working great, but I am unable to make the code working when I change the timeframe of supertrend, eg. I want to use the 1hr suprtrend in 5 mins chart. It is very very important to me and I am stuck to complete my strategy because of that. Will you please help me on this part ?

I will be highly obliged if you can throw some light on this.

Thanks & regards,

Prady

Dear All,

Could anyone please help me out, “How can I put 15min Supertrend attach into 5min chart”.

is there any same afl available ???

With Regards

Abhishek Nema

hrsi indicator formula please

it is already included in the afl code.