//+------------------------------------------------------------------+
//| SimpleEA_hiaju.mq4 |
//| Copyright 2020, MetaQuotes Software Corp. |
//| https://triantoadi.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link "https://triantoadi.com"
#property version "1.00"
#property strict
extern int StartHour = 9;
extern double Lots = 0.1;
extern int SL = 40;
extern int TP = 40;
void OnTick()
{
static bool FirstTick = true;
static int ticket = 0;
if(Hour() == StartHour)
{
if(FirstTick == true)
{
FirstTick = false;
if(Open[0] < Open[StartHour])
{
ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 10,Bid - SL*Point*10, Bid + TP*Point*10, "Simple EA" );
if(ticket < 0)
{
Alert("Sending Order Error !");
}
}
else
{
ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, 10,Ask + SL*Point*10, Ask - TP*Point*10, "Simple EA" );
if(ticket < 0)
{
Alert("Sending Order Error !");
}
}
}
}
else
{
FirstTick = true;
}
}