Hi all

I am banging my head against what must be some very simple coding problems...the basic fundamental type. A few moments of someones time would be greatly appreciated.

I am setting up a simple 'Open +/- Previous range' breakout algorithm with a "First Profitable Opening' exit (yeah...Larry Williams stuff. I have done this on previous software packages, but can't do it here. Below is the code and the chart. The code contains other non-relevant statements that I will eventually use. For now, just focus on the enterShort and exitShort parts.

The problems:

1. Getting Zorro to enter at the Open - 30% of yesterdays range. When I make the 'Entry = shortentry;' negative to indicate stop entry, I get fills in places where the price did not trade.

2. Getting Zorro to exit. I assume the problem is in the IF statement.

Thanks in advance.

EDIT: I removed the above mentioned non-relevant code and replaced the graph.

Quote:

function run()
{

set(PARAMETERS+FACTORS+LOGFILE);
LookBack = 100;
StartDate = 20130101;
EndDate = 20131230;

while(asset(loop("AUD/USD","EUR/USD","GBP/USD","NZD/USD","USD/CAD","USD/CHF","USD/JPY")))
{

BarPeriod = 1400;

var shortentry = priceOpen() - (0.3 * (priceHigh(1)-priceLow(1)));

TimeWait = 1; // Remove pending orders at end of market day

if ( TRUE )
{

Entry = shortentry;
enterShort();
}


if ( TradeResult > 0 )
{
exitShort();
}
}

PlotScale = -10;
PlotWidth = 1400;
PlotHeight1 = 500;

}


Attached Files
Untitled.png (8 downloads)
Last edited by DMB; 08/29/13 09:30.