METAEDITOR QUESTION

 
I'm interested in making an automatic system which performs pending orders based on a data file.
I'm not sure if this should be a script or an indicator, and i'm not sure on how to write the exact code either.
I have a script which i made this far (only from little experience in vb):
//+------------------------------------------------------------------+
//|                                                        Tomba.mq4 |
//|                      Copyright © 2006, MetaQuotes Software Corp. |
//|                                        https://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link      "https://www.metaquotes.net/"
 
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
//----
   int handle;
   bool RD;
   datetime RDTime;
   datetime RDExp;
   string RDSym;
   double RDBuy;
   double RDSell;
 
   handle = FileOpen("data.txt", FILE_READ, ";");
   if (handle < 1) {
         RDTime = StrToTime(FileReadString(handle));
         RDExp = StrToTime(FileReadString(handle));
         RDSym = FileReadString(handle);
         FileClose(handle);
   }
   
   RD = False;
   
   while (RD != True) {
      if (RDTime == TimeCurrent()) {
            OrderSend(RDSym,OP_BUY,1,Ask+10*Point,3,Ask-10,Ask+30,"Tomba",16384,RDExp,Green);
            RD = True;
      }
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+


I thank in advance to everyone who might help!

Tomba.

 

Use an expert advisor or a script working in endless loop.

 
RickD wrote:

Use an expert advisor or a script working in endless loop.


Ok, thanx. I tried configuring it also as a script and also as an expert advisor, but it still didn't work.
The code:
//+------------------------------------------------------------------+
//|                                                        Tomba.mq4 |
//|                      Copyright © 2006, MetaQuotes Software Corp. |
//|                                        https://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "bla"
#property link      "http://www.bla.net"
 
extern double Lots = 1;
extern double EnterPrice = 10;
extern double StopLoss = 20;
extern double Limit = 30;
 
extern string FileName = "data.txt";
 
int start()
  {
     ObjectsDeleteAll();
     int handle;
         handle=FileOpen(FileName,FILE_CSV|FILE_READ,';');
         if(handle<1)
         {
            Print("File not found, the last error is ", GetLastError());
            return(false);
         }
        
         string sDate=FileReadString(handle); // Date
         string sTime=FileReadString(handle); // Time
         string sExpiration=FileReadString(handle); // Expiration Time
         string sCurrency=FileReadString(handle); // Currency
         string sDescription=FileReadString(handle); // Description
         string sImpact=FileReadString(handle); // Impact
         
         datetime Exp = StrToTime(sExpiration);
         datetime newTime = StrToTime(sTime)
 
 
     int i = 0;
 
     while (i == 0)
     {
     
         if (newTime == TimeCurrent)
         {
            double BuyP = Ask+EnterPrice*Point;
            double SellP = Bid+EnterPrice*Point;
            
            OrderSend(sCurrency,OP_BUY,Lots,BuyP,3,BuyP-StopLoss*Point,BuyP+Limit*Point,"Tomba Buys!",16384,Exp,Green);
            OrderSend(sCurrency,OP_SELL,Lots,SellP,3,SellP+StopLoss*Point,SellP-Limit*Point,"Tomba Sells!",16385,Exp,Red);
            i = 0
         }
      }
   return(0);
  }
//+------------------------------------------------------------------+
Anyone got any idea how to help me?
Much obliged,
Tomba.
 
1-
datetime newTime = StrToTime(sTime) <-- missing semicolon!
2-
Open a pending orders you have to use:

OP_BUYLIMIT
OP_SELLLIMIT
OP_BUYSTOP
OP_SELLSTOP

I'm still checking the code :)
 
mqldev:
1-
datetime newTime = StrToTime(sTime) <-- missing semicolon!
2-
Open a pending orders you have to use:

OP_BUYLIMIT
OP_SELLLIMIT
OP_BUYSTOP
OP_SELLSTOP

I'm still checking the code :)


Thanx alot! i'll try to figure it out in the meanwhile.
If you'll have a solution i'll be happy to know:)

Tomba.
 

I also forgot "()" on TimeCurrent:P

 
Tomba wrote:
mqldev:
1-
datetime newTime = StrToTime(sTime) <-- missing semicolon!
2-
Open a pending orders you have to use:

OP_BUYLIMIT
OP_SELLLIMIT
OP_BUYSTOP
OP_SELLSTOP

I'm still checking the code :)


Thanx alot! i'll try to figure it out in the meanwhile.
If you'll have a solution i'll be happy to know:)

Tomba.
Visit mqldev.com and tell me what do you want!
 
did it, thanx.
lookin for a response from ya there.

Tomba.
Reason: