Stochastics with Long Term EMA filter strategy
To create the STOCHASTICS WITH LONG TERM EMA FILTER strategy, one can use Strategy Builder which allows combining strategy and money management rules with the powerful capabilities of the Optimization Wizard and Genetic Algorithms.
To find the optimal parameters, one needs to replace the numeric constants in the trading rules with optimization variables. Additionally, one needs to specify the range (minimum, maximum) and step (increment) for each optimization variable.
The following is the code for the Stochastics with Long Term EMA filter strategy:
Entry Long
var
opt1:=#;
opt2:=#;
opt3:=#;
opt4:=#;
H_L:=Highest(C, opt1) - Lowest(C, opt1);
end_var
if (H_L=0) then return false; {prevent division by zero}
return Mov((C - Lowest(CLOSE, opt1)) / (H_L), opt2, S) < 0.5 - 0.01 * opt3 and CLOSE > Mov(CLOSE, opt4, E);
Exit Long
var
opt1:=#;
opt2:=#;
opt3:=#;
opt4:=#;
H_L:=Highest(CLOSE, opt1) - Lowest(CLOSE, opt1);
end_var
if (H_L=0) then return false; {prevent division by zero}
return Mov((CLOSE - Lowest(CLOSE, opt1)) / (H_L), opt2, S) > 0.5 + 0.01 * opt3 or CLOSE < Mov(CLOSE, opt4, E);
Entry Short
var
opt1:=#;
opt2:=#;
opt3:=#;
opt4:=#;
H_L:=Highest(CLOSE, opt1) - Lowest(CLOSE, opt1);
end_var
if (H_L=0) then return false; {prevent division by zero}
return Mov((CLOSE - Lowest(CLOSE, opt1)) / (H_L), opt2, S) >0.5 + 0.01 * opt3 and CLOSE < Mov(CLOSE, opt4, E);
Exit Short
var
opt1:=#;
opt2:=#;
opt3:=#;
opt4:=#;
H_L:=Highest(CLOSE, opt1) - Lowest(CLOSE, opt1);
end_var
if (H_L=0) then return false; {prevent division by zero}
return Mov((CLOSE - Lowest(CLOSE, opt1)) / (H_L), opt2, S) < 0.5 - 0.01 * opt3 or CLOSE > Mov(CLOSE, opt4, E);
After the optimization, one can view and analyze the Strategy Performance Report and Trades Report - on each combination of the values tested, as well as the combination's Equity and Drawdown curves. The best combinations can be saved as separate strategies.
|
Download to import into Tradecision. 
How to use this indicator in Tradecision:
- Click Download.
- Save this indicator in a safe location on your hard drive.
- Open Tradecision and in the Tools menu click Indicator Builder.
- In the Indicator Builder dialog, click Import, locate the saved file and then click OK.
The indicator will be added to the Custom Indicators list.
|