SuperTrend Indicator Strategy

Strategies are published here.

Moderator: admin

SuperTrend Indicator Strategy

Postby Apprentice » Wed Oct 10, 2012 6:35 am

SuperTrend Indicator Strategy.png

Long
Price/ SuperTrend CrossOver
Short
Price/ SuperTrend CrossUnder


when trend line is red = close long and open short
When trend line is green = close short and open long

SuperTrend Indicator Strategy.lua
(16.23 KiB) Downloaded 1565 times


If you do not have ST.lua Indicator, you will need installed it.
viewtopic.php?f=17&t=605

The Strategy was revised and updated on January 22, 2019.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36435
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Re: SuperTrend Indicator Strategy

Postby dogxyz » Fri Oct 07, 2016 12:16 pm

When I use this SuperTrend Indicator Strategy for backtest in MarketScope of TS II, I can't get the correct indicator data. Please see my attached figure. I add the following debug messages in the end of ExtUpdate():

core.host:trace("update "..GetDateTime().." period="..period);
core.host:trace(" open= "..Source.open[period].." close= "..Source.close[period].." high= "..Source.high[period].." low= "..Source.low[period]);
core.host:trace(" SUPERTREND= "..Indicator.DATA[period]);
if Indicator.DATA:colorI(period)== core.rgb(0, 255, 0) then
core.host:trace(" SUPERTREND is green (UP)\n");
elseif Indicator.DATA:colorI(period)== core.rgb(255, 0, 0) then
core.host:trace(" SUPERTREND is red (DN)\n");
end

At the beginning, it is ok to get SuperTrend indicator data and color. After the first trend change about 2016/2/22 03:15, it fails to get the correct indicator data and color.

This problem only happens when I use Backtest with SuperTrend strategy. It is ok if run in real time. Is there anybody could help me? Thanks.
Attachments
problem.png
Backtest log
dogxyz
 
Posts: 7
Joined: Wed Sep 28, 2016 3:20 am

Re: SuperTrend Indicator Strategy

Postby Apprentice » Sun Jan 07, 2018 8:22 am

The strategy was revised and updated.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36435
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Return to Custom Strategies

Who is online

Users browsing this forum: No registered users and 19 guests