TICKS flag

Posted By: Georgez

TICKS flag - 08/17/15 07:18

In my script enters and exits are within the same bar in most cases, as Stop and TakeProfit are smaller ATR.
So I use the TICKS flag, but still get 100% profitable trades and unreal annual profit.
Why TICKS does not work?

Code:
function run(){
	BarPeriod = 1440;
	LookBack = 500;
	set(LOGFILE+TICKS);
	StartDate = 2010;
	EndDate   = 2015;
	//while(asset(loop("EUR/USD", "USD/CHF", "USD/JPY", "XAU/USD", "GBP/USD", 
	//                 "USD/CAD", "NZD/USD", "AUD/USD", "GBP/JPY", "UKOil", "USD/JPY", "SPX500", 
	//                 "XAG/USD", "XAU/USD", "SPX500", "Bund"))){ // 
	var atr = ATR(80);
	Stop = 3.3*atr;
	TakeProfit = 0.25*Stop;

	vars Price1 = series( price(0) );
	vars Trend = series(LowPass(Price1, 500));
	var sellPrice, buyPrice, stopPrice, profitPrice;
	
	if(falling(Trend)){
		exitLong();
		if(NumOpenShort<1){
			sellPrice = priceClose(0)+0.9*atr;
			stopPrice = sellPrice + Stop;
			profitPrice = sellPrice - TakeProfit;
			print(TO_LOG, "\n%s: Sell Limit at price %.4f, Stop %.4f, Target %.4f. ", Asset, sellPrice, stopPrice, profitPrice);
			print(TO_HTML, "<br>%s: Sell Limit at price %.4f, Stop %.4f, Target %.4f. ", Asset, sellPrice, stopPrice, profitPrice);
			enterShort(0, -sellPrice); // Sell Limit
		}
	}
	else if(rising(Trend)){
		exitShort();
		if(NumOpenLong<1){ 
			var buyPrice = priceClose(0)-0.9*atr;
			stopPrice = buyPrice - Stop;
			profitPrice = buyPrice + TakeProfit;
			print(TO_LOG, "\n%s: Buy Limit at price %.4f, Stop %.4f, Target %.4f. ", Asset, buyPrice, stopPrice, profitPrice);
			print(TO_HTML, "<br>%s: Buy Limit at price %.4f, Stop %.4f, Target %.4f. ", Asset, buyPrice, stopPrice, profitPrice);
			enterLong(0, -buyPrice); // Buy Limit
		}
	}

	plot("Trend", Trend, 0, GREY);
	plot("atr", atr, NEW, BLUE);
//}

}



http://SSMaker.ru/c78a9da2/
Posted By: royal

Re: TICKS flag - 08/17/15 10:08

You have found the holy grail eek tongue
Try it again with the FAST flag set, then it should work laugh
Posted By: Georgez

Re: TICKS flag - 08/18/15 07:36

Thanks, it seems it is working
© 2024 lite-C Forums