#property strict input double Lot = 0.01; input double SLpips = 15; input double TPpips = 5; input int Magic = 114514; void OnTick() { if( OrdersTotal() > 0 ) return; //青いラインがでている=バッファ0が-1でない if( iCustom(Symbol(),Period(),"HBB",0,1) != -1 ) { if( iCustom(Symbol(),Period(),"EMA Signal",0,1) < 10000000 ) { //買いオーダー int Ticket = OrderSend(Symbol(),OP_BUY,Lot,Ask,30,0,0,NULL,Magic,0,clrRed); if( Ticket > 0 ) { OrderSelect(Ticket,SELECT_BY_TICKET); double SL = NormalizeDouble(OrderOpenPrice() - SLpips*10*Point,Digits); double TP = NormalizeDouble(OrderOpenPrice() + SLpips*10*_Point,Digits); OrderModify(OrderTicket(),OrderOpenPrice(),SL,TP,0,clrNONE); } } } //赤いラインがでている=バッファ1が-1でない else if( iCustom(Symbol(),Period(),"HBB",1,1) != -1 ) { if( iCustom(Symbol(),Period(),"EMA Signal",1,1) < 10000000 ) { //売りオーダー int Ticket = OrderSend(Symbol(),OP_SELL,Lot,Bid,30,0,0,NULL,Magic,0,clrBlue); if( Ticket > 0 ) { OrderSelect(Ticket,SELECT_BY_TICKET); double SL = NormalizeDouble(OrderOpenPrice() + SLpips*10*Point,Digits); double TP = NormalizeDouble(OrderOpenPrice() - SLpips*10*_Point,Digits); OrderModify(OrderTicket(),OrderOpenPrice(),SL,TP,0,clrNONE); } } } }