byte PositionTrade;
double PriceTradeEntry, PriceTradeExit;
function run()
{
BarPeriod = 1;
StartDate = 20140107;
EndDate = 20150106;
set(BALANCE + OPENEND + LOGFILE + TICKS);
switch(PositionTrade)
{
case 0: //Long Entry
if(random() > 0)
{
enterLong();
PriceTradeEntry = AskPrice;
PositionTrade = 1;
}
break;
case 1: //Long Exit
if(random() < 0)
{
exitLong();
PriceTradeExit = AskPrice - Spread;
print(TO_CSV, "Entry, %.6f, Exit, %.6fn", PriceTradeEntry, PriceTradeExit);
PositionTrade = 0;
}
}
}