//+------------------------------------------------------------------+ //| Nirmal.B.Singh.mq4 | //| Copyright 2016, MetaQuotes Software Corp. | //| https://www.mql5.com | //| Developed by : Nirmal B Singh | //+------------------------------------------------------------------+ #property copyright "Copyright 2016, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict //+------------------------------------------------------------------+ //| Expert initialization function | double dPrice=0; double dIsar=0; double dTp=0; double dSl=0; int lTicket=0; int ordertotal=0; int EngineStart=0; //+------------------------------------------------------------------+ int OnInit() { //--- create timer EventSetTimer(2); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- destroy timer EventKillTimer(); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- } //+------------------------------------------------------------------+ //| Timer function | //+------------------------------------------------------------------+ void OnTimer() { //--- dIsar = iSAR("EURUSD",1,0.02, 0.20, 0); dPrice =MarketInfo("EURUSD",MODE_BID); ordertotal=OrdersTotal(); //Alert(ordertotal); if((dIsardPrice) && (EngineStart==0) && (ordertotal==0))//sell { EngineStart=2; } //Alert(EngineStart); //Alert(lTicket); //Alert(OrdersTotal()); if((ordertotal==0) && (EngineStart==2)) { //Alert(1); if(dIsardPrice)//sell { // Alert(4); dTp=dPrice-0.00020; dSl=dPrice+0.01000; EngineStart=2; lTicket = OrderSend("EURUSD",OP_SELL,1.34,dPrice,3,dSl,dTp); //Alert (GetLastError()); } } } //+------------------------------------------------------------------+ //| Tester function | //+------------------------------------------------------------------+ double OnTester() { //--- double ret=0.0; //--- //--- return(ret); } //+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { //--- } //+------------------------------------------------------------------+