//+------------------------------------------------------------------+ //| SHI_SilverEx.mq4 | //| Kalenzo | //| //+------------------------------------------------------------------+ #property copyright "Kalenzo" #property link "simone@konto.pl" int cbars=0; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { if(cbars == 0) { cbars = Bars; } double buy = EMPTY_VALUE,sell = EMPTY_VALUE; int ticket = 0; buy = iCustom(Symbol(),0,"SHI_SilverTrendSig",0,30,9.0,0,0); sell = iCustom(Symbol(),0,"SHI_SilverTrendSig",0,30,9.0,1,0); if(Bars > cbars && buy != EMPTY_VALUE) { cbars = Bars; ticket = OrderSend(Symbol(),OP_BUY,1,Ask,3,30*Point,15*Point,NULL,0,0,CLR_NONE); if(ticket<0) { Print("OrderSend failed with error #",GetLastError()); return(0); } } else if(Bars > cbars && sell != EMPTY_VALUE) { cbars = Bars; ticket = OrderSend(Symbol(),OP_SELL,1,Bid,3,30*Point,15*Point,NULL,0,0,CLR_NONE); if(ticket<0) { Print("OrderSend failed with error #",GetLastError()); return(0); } } return(0); } //+------------------------------------------------------------------+