Thread: MQL4 Learning
View Single Post
  #156 (permalink)  
Old 07-31-2007, 05:06 PM
MQL4 MQL4 is offline
Member
 
Join Date: Jul 2007
Posts: 41
MQL4 is on a distinguished road
Thank You Michel,
I agree with You. Also,
I modified everything, can You please check it, and change mistakes???

At 12:30 it is to set a buystop 10 pips above the current price, and set a sellstop 10 pips below the current pirce.

PHP Code:
//+------------------------------------------------------------------+
//|                                                        Eagle.mq4 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""


//Input Parameters----------------------------------------------------
 
extern double StopLoss 10;
extern double TakeProfit 20;
extern double TrailingStop 10;
extern double Lots 1.0;
extern int ShiftUP 10//How much pips to buy above price
extern int ShiftDOWN 10//How much pips to sell below price
extern int StartHour 12;
extern int StartMinute 30;
extern int StartSecond 00;
int Magic=10000000000000
 
//Start Coding--------------------------------------------------------- 
 
int start()
{
if (
OrdersTotal()==0
  {
    if (
Hour()==StartHour)
      {
        if (
Minute()>=StartMinute)
          {
            if (
Seconds()>=StartSecond)
              {
                
OrderSend(Symbol(),OP_BUYSTOP,Lots,Ask+ShiftUP*Point,3,Ask-StopLoss*Point+ShiftUP*Point,Ask+TakeProfit*Point+ShiftUP*Point,"learn the syntax",Magic,0,Green); 
                
OrderSend(Symbol(),OP_SELLSTOP,Lots,Bid-ShiftDOWN*Point,3,Bid+StopLoss*Point-ShiftDOWN*Point,Bid-TakeProfit*Point-ShiftDOWN*Point,"learn the syntax",Magic,0,Green);
              }
          }           
      }
  }

Return(
0);

I woke up today, and I ran the Eagle in real-time, and it only set a buystop. Then, I did it a second time, and it did everything right. Then, I did it the third time, and it only made a sellstop. I think something is wrong with my code, can You please check it Michel, or anyone.
Reply With Quote