avatar
EA001

Cuongitl 551 28th Aug, 2020

CSHARP 2.52 KB
                                           
                         //+------------------------------------------------------------------+
//|                                                      ProjectName |
//|                                      Copyright 2018, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+
extern int OrderPropeties;
double OpenPrice;
extern double Lot = 0.01;
double StopLoss;
double TakeProfit;
extern string Note;
extern color Color = clrRed;

bool res;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
  {

   hehe();
//---------------------------
//--- create timer
   EventSetTimer(60);

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy timer
   EventKillTimer();

  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void hehe()
  {
   Print("OrderPropeties: ", OrderPropeties);
//if(OrdersTotal() > 0)
//   return;  // chi cho vao 1 lenh
//----

   if(OrderPropeties == OP_SELL)
     {
      OpenPrice   =  Bid;
      StopLoss    =  OpenPrice + 20 * 10 * Point();
      TakeProfit  =  OpenPrice - 20 * 10 * Point();

     }

   if(OrderPropeties == OP_BUY)
     {
      OpenPrice   =  Ask;
      StopLoss    =  OpenPrice - 20 * 10 * Point();
      TakeProfit  =  OpenPrice + 20 * 10 * Point();
     }
   Print("Symbol: ", Symbol(), ", OpenPrice= ", OpenPrice, ", SL= ", StopLoss, ", TP= ", TakeProfit);

   res = OrderSend(Symbol(), OrderPropeties, Lot, OpenPrice, 20, StopLoss, TakeProfit, Note, 0, 0, Color);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick()
  {



  }
//+------------------------------------------------------------------+
                      
                                       
To share this paste please copy this url and send to your friends
RAW Paste Data

Comments

Authentication required

You must log in to post a comment.

Log in
    There are no comments yet.