I am going to use this thread to ask questions as I develop my strategy. Since most of my questions will be minor I will keep them all in one thread.
I am coding an open range break out strategy similar to that which Larry Williams' taught. I am writing the code so that once I have one good algorithm, I can duplicate it and alter it for other filter conditions.
First question: I am trying to scale the plot so that I can see if the code is doing what I want it to do. But either the chart is to dense or no trades appear. See the example attached for the later. The odd thing is that the equity curve is shown, but not trades.
Below is my code so far for reference:
// Open - ATR stop short entry with a close trend filter.
function tradeBOSTrend()
{
vars Price = series(price());
var BreakoutValue;
BreakoutValue = optimize(1,0.2,2,0.1) * (priceHigh(1)-priceLow(1));
var shortentry = priceOpen() - (BreakoutValue * (priceHigh(1)-priceLow(1)));
var stopFactor = optimize(1,0.2,2,0.1) ;
Stop = stopFactor * ATR(100);
Trail = stopFactor * ATR(100);
int compareClose = optimize(1,1,10,1);
if ( priceClose(1) < priceClose(compareClose) )
{
Entry = shortentry;
enterShort();
}
for(open_trades)
if(TradeIsOpen and TradeResult > 0)
exitTrade(ThisTrade);
}
function run()
{
set(PARAMETERS+LOGFILE); // use optimized parameters
BarPeriod = 1440; // Daily bars
LookBack = 150;
StartDate = 2007;
NumWFOCycles = 8; // activate WFO, 8 cycles
if(ReTrain) {
SelectWFO = -1; // when re-optimizing, select the last cycle only
UpdateDays = -1; // update price data from the server
}
while(asset(loop("EUR/USD")))
while(algo(loop("BO_S_Trend")))
{
if(strstr(Algo,"BO_S_Trend"))
tradeBOSTrend();
}
PlotBars = 100;
PlotScale = -10;
PlotWidth = 1000;
PlotHeight1 = 500;
}