I took the liberty to write the CTL code for the strategy i found on
http://www.free-forex-systems.com/
Full description of this strategy can be found:
http://www.free-forex-systems.com/forex-trading-system-SuperSar-Strategy
The code for those that are using a new version of dealbook or prostation.
strategy SuperSarStrategy;
input period = 10, lots = 1,
CalcPriceType = 1,
TrendPriceType = 2,
VolatPeriod = 1,
VolatCoeff = 1.8,
AvgToVolatRatio = 10,
UpDnCalcType = 6;
begin
integer currentbar;
SuperTrend(CalcPriceType, TrendPriceType, VolatPeriod, VolatCoeff, AvgToVolatRatio, UpDnCalcType);
currentbar:= back(SuperTrend.Stop);
if currentbar < front(SuperTrend.Stop)+2 then
return;
Parabolic_SAR();
if SuperTrend.Stop[currentbar-1] < SuperTrend.AvgPrice[currentbar-1] and
SuperTrend.Stop[currentbar-2] > SuperTrend.AvgPrice[currentbar-2] and
close[currentbar]>Parabolic_SAR.line[currentbar] and
not long() and not short() then buy(lots);
if SuperTrend.Stop[currentbar-1] > SuperTrend.AvgPrice[currentbar-1] and
SuperTrend.Stop[currentbar-2] < SuperTrend.AvgPrice[currentbar-2] and
close[currentbar]<Parabolic_SAR.line[currentbar] and
not long() and not short() then sell(lots);
if long() and close[currentbar]<Parabolic_SAR.line[currentbar] then exitlong();
if short() and close[currentbar]>Parabolic_SAR.line[currentbar] then exitshort();
end.
The code for those that are using the old version of dealbook or prostation.
strategy SuperSarStrategy;
input period = 10, lots = 1,
CalcPriceType = 1,
TrendPriceType = 2,
VolatPeriod = 1,
VolatCoeff = 1.8,
AvgToVolatRatio = 10,
UpDnCalcType = 6;
vars currentbar(number);
begin
SuperTrend(CalcPriceType, TrendPriceType, VolatPeriod, VolatCoeff, AvgToVolatRatio, UpDnCalcType);
currentbar:= back(SuperTrend.Stop);
if currentbar < front(SuperTrend.Stop)+2 then
return;
Parabolic_SAR();
if SuperTrend.Stop[currentbar-1] < SuperTrend.AvgPrice[currentbar-1] and
SuperTrend.Stop[currentbar-2] > SuperTrend.AvgPrice[currentbar-2] and
close[currentbar]>Parabolic_SAR.line[currentbar] and
not long() and not short() then buy(lots);
if SuperTrend.Stop[currentbar-1] > SuperTrend.AvgPrice[currentbar-1] and
SuperTrend.Stop[currentbar-2] < SuperTrend.AvgPrice[currentbar-2] and
close[currentbar]<Parabolic_SAR.line[currentbar] and
not long() and not short() then sell(lots);
if long() and close[currentbar]<Parabolic_SAR.line[currentbar] then exitlong();
if short() and close[currentbar]>Parabolic_SAR.line[currentbar] then exitshort();
end.
Conclusion after backtest:
I agree with the advantages and disadvantage given on that site. It performs great in a trending market but it is terrible if it is ranging. Don't start this strategy when you expect it to be a "ranging" day.
Hi, I've been reading the blog, nice programming and strategies, I'm really happy to find a community with the same interest as me. I've been looking for some answers and maybe you can help me (sorry for my english, is not perfect):
ReplyDelete1.) is there any way in CTL code of fixing the graph period use for the strategy, for example 30 mins. so you can change the graph for viewing more time without affecting estrategy decisions?
2.) I haven't found the correct way to set a maket order with a stop loss and limit gain related to the parent order. they have never worked for me. I dont like using fpl to control maxloss because I'm trading more than one symbol at the same time, so maybe is another symbol which is lossing and not the one in matter.
3.) is there any way of checking available equity?
4.) is there any way to configure dealbook to restablish internet connection and strategies after an internet connection short drop.