I have made another script from the above code and I don't understand the result - actually there is no result.
Please test it and explain why this happens.

Code:
function run(){
	
	int MA_Period = 34;
	
	int crossupvalid = 0;
   int crossdownvalid = 0;
	
	vars main_price = series(price());
	vars main_ma = series(SMA(main_price, MA_Period));
	
	Stoch(5,3,MAType_SMA,3,MAType_SMA);
	
     vars stochk = series(rSlowK);
     vars stochd = series(rSlowD);
	
	TakeProfit = 30*PIP;
	Stop = 20*PIP;
	
	    
	    if(numLong == 0 && main_price[0] > main_ma[0] && stochk[0] < 20)
         enterLong();
     if(numShort == 0 && main_price[0] < main_ma[0] && stochk[0] > 80)
       enterShort();
       
       if(numLong > 0 && stochk[0] < stochd[0])  
       exitLong();
     if(numShort > 0 && stochk[0] > stochd[0])
       exitShort();
}


Last edited by SFF; 12/27/12 12:59.