Backtester won't calculate the difference in values between trade entry and exit points.
Lists all the appropriate trade entry and exit price points, just will not differentiate between Long and Shorts
below is a sample of the backtest code that is being called. There is no question that the overalL trading strategy routine works because the changes in bar colors are correct and also this routine is being used successfully in fully automated order execution routines,
I am included two snippets of code;
the first is what is being used to determine Buy/Sell signals for visual alert by changing chart bar colors. These are the same variable used in the automation routines as well;
the second set is where the back test commands have been added, producing the results mentioned above
if (vSMA < SLAMAValue) {
setPriceBarColor(Color.green);
setBarThickness(2);
setBarFgColor(Color.green);
} else if(SLAMAValue < vSMA) {
setPriceBarColor(Color.red);
setBarThickness(2);
setBarFgColor(Color.red);
}
vlastSLAMAValue=SLAMAValue;
return new Array(SLAMAValue,vSMA);
Here is the backtest code that is being used
if(vSMA < SLAMValue && !Strategy.isLong())
Strategy.doLong("Long", Strategy.MARKET, Strategy.THISBAR);
{
setPriceBarColor(Color.green);
setBarThickness(2);
setBarFgColor(Color.green);
} else if(SLAMAValue < vSMA) {
if(SLAMAValue < vSMA && !Strategy.isShort())
Strategy.doShort("Short", Strategy.MARKET, Strategy.THISBAR);
setPriceBarColor(Color.red);
setBarThickness(2);
setBarFgColor(Color.red);
}
vlastSLAMAValue=SLAMAValue;
return new Array(SLAMAValue,vSMA);
Lists all the appropriate trade entry and exit price points, just will not differentiate between Long and Shorts
below is a sample of the backtest code that is being called. There is no question that the overalL trading strategy routine works because the changes in bar colors are correct and also this routine is being used successfully in fully automated order execution routines,
I am included two snippets of code;
the first is what is being used to determine Buy/Sell signals for visual alert by changing chart bar colors. These are the same variable used in the automation routines as well;
the second set is where the back test commands have been added, producing the results mentioned above
if (vSMA < SLAMAValue) {
setPriceBarColor(Color.green);
setBarThickness(2);
setBarFgColor(Color.green);
} else if(SLAMAValue < vSMA) {
setPriceBarColor(Color.red);
setBarThickness(2);
setBarFgColor(Color.red);
}
vlastSLAMAValue=SLAMAValue;
return new Array(SLAMAValue,vSMA);
Here is the backtest code that is being used
if(vSMA < SLAMValue && !Strategy.isLong())
Strategy.doLong("Long", Strategy.MARKET, Strategy.THISBAR);
{
setPriceBarColor(Color.green);
setBarThickness(2);
setBarFgColor(Color.green);
} else if(SLAMAValue < vSMA) {
if(SLAMAValue < vSMA && !Strategy.isShort())
Strategy.doShort("Short", Strategy.MARKET, Strategy.THISBAR);
setPriceBarColor(Color.red);
setBarThickness(2);
setBarFgColor(Color.red);
}
vlastSLAMAValue=SLAMAValue;
return new Array(SLAMAValue,vSMA);
Comment