Walstreet.lv
Jaunākais forumāPalīdzībaLietošanas noteikumiReģistrācijaAizmirsu paroliLogin
Forumu saraksts/Hard & Soft/Palīdziet ar skriptu MT4 platformai!!!
Lapas:12next
Inguss
Inguss
Pievienots: 18.02.2005
Ziņojumi: 154
Palīdziet ar skriptu MT4 platformai!!!
16.10.2006 00:29
Nezinu vai tas ir iespeejams, bet man ir ljoti nepiecieshams kaads skriptelis, kursh speetu atveert poziicijas noteiktaa laikaa!!! Kjip pulksten 15:30(vai kaadaa citaa laikaa) tiktu atveerta long vai short poziicija ar visiem TP un SL!

 gudrie viiri, paliidziet, jums droshi vien kaut ko taadu uztaisiit aiznems 5cas minuutes wink
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Palīdziet ar skriptu MT4 platformai!!!
16.10.2006 09:56
if (Hour()==15 && Minute()==30)
    {
          OrderSend(Symbol(),OP_SELL,Lots,Bid,0,SL,TP,"sell",1,0,Red);
    }

Nav jau gan jausmas cik daudz Tu pats proti vai neproti, bet katraa zinjaa to laiku var iestradat saadi te.
Inguss
Inguss
Pievienots: 18.02.2005
Ziņojumi: 154
Re: Palīdziet ar skriptu MT4 platformai!!!
16.10.2006 14:26
Par taa laika ievietoshanu es sapratu smile Bet taalaak gan neskaidriiba! Negribas mineet tadeel uzmet man luudzu piemeeru BUY EURUSD 15:30  TP=40, SL=15, Lots=0.1

 

Kjipo shitaa tas izskatiitos? Ja ir nepareizi izlabo luudzu ;)

{

OrderSend(Symbol(EURUSD),OP_BUY,0.1,0,15,40,"buy",1,0,Red0;

}
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Palīdziet ar skriptu MT4 platformai!!!
16.10.2006 14:53
tad nu taa:

if (Hour()==15 && Minute()==30)
{
OrderSend("EURUSD",OP_BUY,0.1,Ask,0,Bid-0.015,Bid+0.040,"buy",1,0,Red);
}

Tagad nedaudz par pasu kodu. Ja izmanto funkciju Symbol(), tad taa atgriez tekoso finansu instrumentu, teiksim ja experts ir piekabinats pie EURUSD grafika, tad to arii atgriezis. Bet ja veelas, tad var kodaa tiesi noradit EURUSD. Tiesi to es arii esmu izdarijis.
 Kodaa obligati janoraada pa kaadu cenu peerc .. tas ir Ask. Tev taas nebij.
 Take profit ir jaapreekina kaa tekosaa cena plus tik cik veelies pielikt, bet nevis vienkarsi pipsu skaits.  Tas pats attiecas uz SL.
 
Inguss
Inguss
Pievienots: 18.02.2005
Ziņojumi: 154
Re: Palīdziet ar skriptu MT4 platformai!!!
16.10.2006 16:26
loaded successfully
removed

 

Kjip ielaadee, bet tajaa pashaa laikaa izdzeesh to skriptu...kas par sviestu, kaadeel vinu nevar piekabianaat pie grafika? Varbuut ko nepareizi daru, vai arii kaut ko nezinu...a?
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Palīdziet ar skriptu MT4 platformai!!!
16.10.2006 16:27
par kaadu skriptu tiesi iet runa???
Inguss
Inguss
Pievienots: 18.02.2005
Ziņojumi: 154
Re: Palīdziet ar skriptu MT4 platformai!!!
16.10.2006 16:34
if (Hour()==15 && Minute()==30)
{
OrderSend("EURUSD",OP_BUY,0.01,Ask,0,Bid-0.015,Bid+0.040,"buy",1,0,Red);
}

Par sho pashu!!!

Taa kaa demo darbojos uz microForex tadel izmainiju Lot=0.01! Laiku skripts skataas no kompja pulkstena via platformas?
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Palīdziet ar skriptu MT4 platformai!!!
16.10.2006 16:52
Juutu sitaa mes nekur netiksim, ok seit bus pilns teksts. Taa sakot pats minums lai tas viss stradatu.

//                                                          nnn.mq4 |
int init()
  {
//----
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
      if (Hour()==15 && Minute()==30)
         {
            OrderSend("EURUSD",OP_BUY,0.1,Ask,0,Bid-0.015,Bid+0.040,"buy",1,0,Red);
         }
   return(0);
  }
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Palīdziet ar skriptu MT4 platformai!!!
16.10.2006 16:54
Nezinu vai tiesam var tirgot uz  0.01, bet var jau but, ka arii var.
 Laiku vins skataas peec tirdzniecibas servera, bet nevis pec lokala datora pulkstenja.
Inguss
Inguss
Pievienots: 18.02.2005
Ziņojumi: 154
Re: Palīdziet ar skriptu MT4 platformai!!!
16.10.2006 17:15
RealTrade piedaavaa microForex!

Nu neeiet man tas Experts... tjip pievienoju, ieliku kjeksiiti ,lai ljauj ekspertam tirgot un noteiktaa laikaa nekas nenotiek...kas par vainu vareetu buut?

 
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Palīdziet ar skriptu MT4 platformai!!!
16.10.2006 17:23
nu nezinu gan. tikko pameginaju uz MIG demo versijas .. viss iet kaa pulkstenis:}
 Ja Tev pie grafika augsaa tas smailiks smaida, tad noteikti visu saaktivizejis esi pareizi. TAd vienigais ko varu iedomaties, ka kaut kaadi parametri ir nepareizi noraditi. Lai gan, jupis vinu zin .. vins Tev kaut ko nelemajas? Nav kaut kaadu ieraxtu Experts vai Journal logaa?
Inguss
Inguss
Pievienots: 18.02.2005
Ziņojumi: 154
Re: Palīdziet ar skriptu MT4 platformai!!!
16.10.2006 17:31
Smailika nav ir krustinjsh! Cik nopratu tas noraada uz probleemu! Pameginashu uz citu MT platformu uuzmest to skriptu!
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Palīdziet ar skriptu MT4 platformai!!!
16.10.2006 17:48
Tad TEv vienkarsi vajag augsaa riiku joslaa nospiest pogu Expert Advisors. TAd pec idejas visam vajazdetu iet.
Inguss
Inguss
Pievienots: 18.02.2005
Ziņojumi: 154
Re: Palīdziet ar skriptu MT4 platformai!!!
16.10.2006 17:57
Jopt, pat MT veel nav izkosts laugh

Viss aizgaaja peec taa pogas, riiku joslaa, nospieshanas smile

Thanks beer  wink
Inguss
Inguss
Pievienots: 18.02.2005
Ziņojumi: 154
Re: Palīdziet ar skriptu MT4 platformai!!!
16.10.2006 19:33
Sorry ka atkal piekasos, bet nu kaut kas nav...

Kaadeel tas skripts ver valaa vairaakas vienaadas poziicijas??? Nevari kodaa ierakstit, lai saakumaa paarbauda vai nav jau atveerta kaada no poziicijaam un tikai peec apstiprinaajuma lai atver jaunu? Savadaak ja uz M30 grafika pie katras cenas svaarstiibas vinjsh veers valaa poziiciju...tad pats saproti, buus sudi...uz M5 man atveera 7nas poziicijas...tas nu toch nav vajadziigs laugh
abeiks
Pievienots: 12.07.2005
Ziņojumi: 170
Re: Palīdziet ar skriptu MT4 platformai!!!
16.10.2006 21:29
To nezinu

Vai tu nēsi darbojies ar skriptu TimeOut ? Nezini, kā notiek sinhronizācija ar serveri?

http://codebase.mql4.com/ru/213
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Palīdziet ar skriptu MT4 platformai!!!
16.10.2006 21:53
2 Inguss: klau nenjem ljaunaa, bet vai Tu pats negribetu nedaudz pamacities MQL4 valodu, jo savadak nakotnee tacu neiesi katru sikumu foruma prasiit? wink
  Labi, taatad taa .. Tev jadara sekojosi:

// nnn.mq4 |
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
If(OrdersTotal()<1)
{

if (Hour()==15 && Minute()==30)
{
OrderSend("EURUSD",OP_BUY,0.1,Ask,0,Bid-0.015,Bid+0.040,"buy",1,0,Red);
}

}
return(0);
}
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Palīdziet ar skriptu MT4 platformai!!!
16.10.2006 22:15
2 abeiks: neesmu gan petijis un pat nezinaju par taada skripta esamibu. Bet katraa zinjaa bus japapeta .. skiet interesanta stelle.
Katraa zinjaa to sinhronizaciju es iedomaajos taa, ka Tu njem savu lokalo datora pulksteni un pieskano to servera laikam. Pie tam galvenais jau tur ir minutes un sekundes. Pie tam servera laiku jau var izspiest ar vienkarsa eksperta palidzibu .. liidz ar to savu datora pulksteni var nosinhronizet peec sii te laika.
abeiks
Pievienots: 12.07.2005
Ziņojumi: 170
Re: Palīdziet ar skriptu MT4 platformai!!!
17.10.2006 11:03
To nezinu

Es domāju, ka manuāli to nevar darīt, jo nevarēs tik precīzi (līdz milisekundēm) pieskaņot un tad jau visam pasākumam zūd jēga. Katrā gadījumā, ja rodas vēl kāda ideja - padod ziņu!
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Palīdziet ar skriptu MT4 platformai!!!
17.10.2006 18:59
Es papetiju kodu tam TimeOut skriptam .. patiesiba princips ljoti vienkaarss. Vienigi nezinu vai patiesam tas objektivi atspoguljo aizkavesanos.
  Peec idejas sanak, ka sanemot jaunu ticku mes sanjemam arii  servera laiku kaads tas bijis bridi, kad sii kotacija nosutita. Un tagad mums servera laiks janosinhronizee ar savu datora laiku, lai ieguto vajadzigo nobiidi. Bet vai to patiesam ir iespejams izdarit ar precizitaati lidz milisekundeem .. es kaut kaa neesmu parliecinaats. Jo ja teiksim kotaacijas naak ar aizkavesanos, tad kaa lai noskaidro pasaa sakumaa kaads ir patiesais servera laiks?
 Otrs .. vai nav vienkarsak izmantot vienkarsi ping komandu. Ja zin servera ip adresi .. var tacu vienkarsi nopingot.
 Pie tam vel jau var gadities taads variants, ka ne jau  brokeris vainiigs, be pa celjam pakete kaut kur iesprust. Jeb arii pakete aizceljo aatri, bet vinu tirdzniecibas serveris ir parslogots un strada lidz ar to leeni. Sajaa gadijumaa jau sii te laiku salidzinasanas metode skiet vairs neko i nedotu.
abeiks
Pievienots: 12.07.2005
Ziņojumi: 170
Re: Palīdziet ar skriptu MT4 platformai!!!
17.10.2006 21:59
Tam skriptam attiecībā pret pingošanu ir viens liels pluss - var nepārtraukti redzēt laika nobīdes izmaiņas. Nu bet protams, ka tam nav tik liela nozīme, lai lieki lauzītu galvu. smile  Katrā gadījumā paldies, ka padalījies ar domām.

P.S. Iemet aci arī pārējos EA, indikatoros un skriptos tai pat saitā, man daži bij tīri noderīgi un pamācoši! wink
abeiks
Pievienots: 12.07.2005
Ziņojumi: 170
Re: Palīdziet ar skriptu MT4 platformai!!!
27.10.2006 12:55
To nezinu: Par cik esmu galīgs iesācējs programēšanā, tad man radās viena problēma kuru moku jau otro dienu - orderis neverās par augstāko cenu uzdotajā periodā. Varbūt es kautko ne tā rakstu?

Daļa no koda:

double cena;

cena=High[Highest(NULL,0,MODE_HIGH,100,60)];

SellOrderis=OrderSend("GBPUSD",OP_SELLSTOP,0.1,cena,3,Bid-0.0001*Deviation+0.0001*StopLoses,
    Bid-0.0001*Deviation-0.0001*TakeProfit,"sell",1,expiration,Red);

P.S. Ja cenas vietā rakstu normālu Ask vai Bid viss strādā kā nākas.
abeiks
Pievienots: 12.07.2005
Ziņojumi: 170
Re: Palīdziet ar skriptu MT4 platformai!!!
30.10.2006 13:34
To nezinu:

Vairs nevajag, tomēr pats tiku galā! smile
lovesub69
Pievienots: 05.10.2007
Ziņojumi: 4
Re: Palīdziet ar skriptu MT4 platformai!!!
05.10.2007 21:11
Nevaru palidzet ar skriptu bet piedavaju Expert Advisor kura jaievada datums pulkstenis (brokera laiks) stop loss take profit orderu atalumi no esosas cena EA's dabosanas laiku pirms konkreta laika un pec (EA patstavigi modele orderus lidz dotajam laikam) u.t.t. - labs Experts prieks zinam...
lovesub69
Pievienots: 05.10.2007
Ziņojumi: 4
Re: Palīdziet ar skriptu MT4 platformai!!!
05.10.2007 21:14
I-drit-vai azit tevar pievienot failus vai ne?

//+------------------------------------------------------------------+
//|                                      AmazingEA.mq4 Version 1.1.8 |
//|                    Modified by branac, added changable stop loss |
//|                                                |
//|                                                     FiFtHeLeMeNt |
//|                                             http://www.irxfx.com |
//|                                         |
//+------------------------------------------------------------------+
#property copyright "FiFtHeLeMeNt"
#property link      "http://www.irxfx.com"

extern int  Pipsaway=10;
extern int TP=20; // The Exact Amount Of the Pips u will get as the profit in your account
extern int SL=10; // Stop Loss amount in pips
extern int NDay=15;  // News Day
extern int NHour=15; // News Hour FXDD
extern int NMin=30;  // News Minute FXDD
extern int CTCBN=0; // Numbers Candles to check Before News For determining High & Lows , when it is 1 it check 2 candles the current candle and the 1 last one
extern int SecBPO=300; // Seconds Before News Which EA Will Place Pending Orders
extern int SecBMO=0; // Seconds Before News Which EA Will Stop Modifying Orders
extern int STWAN=150; // Seconds To Wait After News to Delete Pending Orders
extern bool OCO=true; // One Cancel The Other , will cancel the other pending order if one of them is hit
extern int BEPips=0; // Pips In profit which EA will Move SL to BE+1 after that
extern int TrailingStop=0; // Trailing Stop
extern bool mm=false;
extern int RiskPercent=3;
extern double Lots=0.1;
extern string TradeLog = " MI_Log";
double h,l,ho,lo,hso,lso,htp,ltp,sp;
int Magic;
string filename;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
    ObjectsDeleteAll();
    return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
    Comment("");
    ObjectsDeleteAll();
//----
   return(0);
  }

double LotsOptimized()
  {
   double lot=Lots;
  //---- select lot size
   if (mm) lot=NormalizeDouble(MathFloor(AccountFreeMargin()*RiskPercent/100)/100,1);
  
  // lot at this point is number of standard lots
   return(lot);
  }

 
int CheckOrdersCondition()
  {
    int result=0;
    for (int i=0;i<OrdersTotal();i++) {
      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if ((OrderType()==OP_BUY) && (OrderSymbol() == Symbol()) && (OrderMagicNumber() == Magic)) {
        result=result+1000;
      }
      if ((OrderType()==OP_SELL) && (OrderSymbol() == Symbol()) && (OrderMagicNumber() == Magic)) {
        result=result+100;
      }
      if ((OrderType()==OP_BUYSTOP) && (OrderSymbol() == Symbol()) && (OrderMagicNumber() == Magic)) {
        result=result+10;
      }
      if ((OrderType()==OP_SELLSTOP) && (OrderSymbol() == Symbol()) && (OrderMagicNumber() == Magic)) {
        result=result+1;
      }

    }
    return(result); // 0 means we have no trades
  }
 
// OrdersCondition Result Pattern
//    1    1    1    1
//    b    s    bs   ss
// 
 
 
void OpenBuyStop()
 {
    int ticket,err,tries;
        tries = 0;
        if (!GlobalVariableCheck("InTrade")) {
          while (tries < 3)
            {
               GlobalVariableSet("InTrade", CurTime());  // set lock indicator
               ticket = OrderSend(Symbol(),OP_BUYSTOP,LotsOptimized(),ho,1,hso,htp,"EA Order",Magic,0,Red);
               Write("in function OpenBuyStop OrderSend Executed , ticket ="+ticket);
               GlobalVariableDel("InTrade");   // clear lock indicator
               if(ticket<=0) {
                  Write("Error Accured : "+ErrorDescription(GetLastError())+" BuyStop @ "+ho+" SL @ "+hso+" TP @"+htp);
                  tries++;
               } else tries = 3;
            }
        }
 }
 
void OpenSellStop()
 {
    int ticket,err,tries;
        tries = 0;
        if (!GlobalVariableCheck("InTrade")) {
          while (tries < 3)
            {
               GlobalVariableSet("InTrade", CurTime());  // set lock indicator
               ticket = OrderSend(Symbol(),OP_SELLSTOP,LotsOptimized(),lo,1,lso,ltp,"EA Order",Magic,0,Red);
               Write("in function OpenSellStop OrderSend Executed , ticket ="+ticket);
               GlobalVariableDel("InTrade");   // clear lock indicator
               if(ticket<=0) {
                  Write("Error Accured : "+ErrorDescription(GetLastError())+" BuyStop @ "+lo+" SL @ "+lso+" TP @"+ltp);
                  tries++;
               } else tries = 3;
            }
        }
 }
 
void DoBE(int byPips)
  {
    for (int i = 0; i < OrdersTotal(); i++) {
     OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
     if ( OrderSymbol()==Symbol() && (OrderMagicNumber() == Magic))  // only look if mygrid and symbol...
        {
            if (OrderType() == OP_BUY) if (Bid - OrderOpenPrice() > byPips * Point) if (OrderStopLoss() < OrderOpenPrice()) {
              Write("Movine StopLoss of Buy Order to BE+1");
              OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() +  Point, OrderTakeProfit(), Red);
            }
            if (OrderType() == OP_SELL) if (OrderOpenPrice() - Ask > byPips * Point) if (OrderStopLoss() > OrderOpenPrice()) {
               Write("Movine StopLoss of Buy Order to BE+1");
               OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() -  Point, OrderTakeProfit(), Red);
            }
        }
    }
  }

void DoTrail()
  {
    for (int i = 0; i < OrdersTotal(); i++) {
     OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
     if ( OrderSymbol()==Symbol() && (OrderMagicNumber() == Magic))  // only look if mygrid and symbol...
        {
         
          if (OrderType() == OP_BUY) {
             if(Bid-OrderOpenPrice()>Point*TrailingStop)
             {
                if(OrderStopLoss()<Bid-Point*TrailingStop)
                  {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
                     return(0);
                  }
             }
          }

          if (OrderType() == OP_SELL)
          {
             if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
             {
                if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
                {
                   OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
                   return(0);
                }
             }
          }
       }
    }
 }
 

void DeleteBuyStop()
{
   for (int i = 0; i < OrdersTotal(); i++) {
     OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
     if (OrderSymbol()==Symbol() && (OrderMagicNumber() == Magic) && (OrderType()==OP_BUYSTOP)) {
       OrderDelete(OrderTicket());
       Write("in function DeleteBuyStopOrderDelete Executed");
     }
      
   }
}
  
void DeleteSellStop()
{
   for (int i = 0; i < OrdersTotal(); i++) {
     OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
     if (OrderSymbol()==Symbol() && (OrderMagicNumber() == Magic) && (OrderType()==OP_SELLSTOP)) {
       OrderDelete(OrderTicket());
       Write("in function DeleteSellStopOrderDelete Executed");
     }
      
   }
}

void DoModify()
{
   for (int i = 0; i < OrdersTotal(); i++) {
     OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
     if (OrderSymbol()==Symbol() && (OrderMagicNumber() == Magic) && (OrderType()==OP_SELLSTOP)) {
       if ((OrderOpenPrice()>lo) || (OrderOpenPrice()<lo)) {
         Write("in function DoModify , SellStop OrderModify Executed, Sell Stop was @ "+DoubleToStr(OrderOpenPrice(),4)+" it changed to "+DoubleToStr(lo,4));
         OrderModify(OrderTicket(),lo,lso,ltp,0,Red);
       }
     }

     if (OrderSymbol()==Symbol() && (OrderMagicNumber() == Magic) && (OrderType()==OP_BUYSTOP)) {
       if ((OrderOpenPrice()>ho) || (OrderOpenPrice()<ho)) {
         Write("in function DoModify , BuyStop OrderModify Executed, Buy Stop was @ "+DoubleToStr(OrderOpenPrice(),4)+" it changed to "+DoubleToStr(ho,4));
         OrderModify(OrderTicket(),ho,hso,htp,0,Red);
       }
     }
   }
}

int Write(string str)
{
   int handle;
 
   handle = FileOpen(filename,FILE_READ|FILE_WRITE|FILE_CSV,"/t");
   FileSeek(handle, 0, SEEK_END);     
   FileWrite(handle,str + " Time " + TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS));
    FileClose(handle);
}

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
 
   Magic=NDay+NHour+NMin;
  
   int i;
   int OrdersCondition,secofday,secofnews;
     
   filename=Symbol() + TradeLog + "-" + Month() + "-" + Day() + ".txt";

   if (BEPips>0) DoBE(BEPips);
  
   if (TrailingStop>0) DoTrail();
  
   OrdersCondition=CheckOrdersCondition();
  
   secofday=Hour()*3600+Minute()*60+Seconds();
   secofnews=NHour*3600+NMin*60;
  
   h=iHigh(NULL,PERIOD_M1,0);
   l=iLow(NULL,PERIOD_M1,0);
   for (i=1;i<=CTCBN;i++) if (iHigh(NULL,PERIOD_M1,i)>h) h=iHigh(NULL,PERIOD_M1,i);
   for (i=1;i<=CTCBN;i++) if (iLow(NULL,PERIOD_M1,i)<l) l=iLow(NULL,PERIOD_M1,i);
   sp=Ask-Bid;
   ho=h+sp+(Pipsaway)*Point;
   lo=l-(Pipsaway)*Point;
   if(SL==0)
   {
      hso = 0;
      lso = 0;
   }
   else
   {
      hso=Ask+(Pipsaway-SL)*Point; //hso=h+sp;
      lso=Bid-(Pipsaway-SL)*Point; //lso=l;
   }
   htp=ho+TP*Point;
   ltp=lo-TP*Point;

   if (Day()!=NDay) {
   Comment("\nAmazing Forex System Expert Advisor v 1.1.8 By FiFtHeLeMeNt\n\nHigh @ ",h," Buy Order @ ",ho," Stoploss @ ",hso," TakeProfit @ ",htp,"\nLow @ ",l," Sell Order @ ",lo," StopLoss @ ",lso," TakeProfit @ ",ltp,"\n\nNews Day : ",NDay,"st"," News Time @ ",NHour,":",NMin," CTCBN : ",CTCBN," SecBPO : ",SecBPO," SecBMO : ",SecBMO," STWAN : ",STWAN," OCO : ",OCO," BEPips : ",BEPips," Money Management : ",mm," RiskPercent: ",RiskPercent," Lots : ",LotsOptimized(),"\n\nExpert is disabled because it is not day of expected news");
     return(0);
   } else Comment("\nAmazing Forex System Expert Advisor v 1.1.8 By FiFtHeLeMeNt\n\nHigh @ ",h," Buy Order @ ",ho," Stoploss @ ",hso," TakeProfit @ ",htp,"\nLow @ ",l," Sell Order @ ",lo," StopLoss @ ",lso," TakeProfit @ ",ltp,"\n\nNews Day : ",NDay,"st"," News Time @ ",NHour,":",NMin," CTCBN : ",CTCBN," SecBPO : ",SecBPO," SecBMO : ",SecBMO," STWAN : ",STWAN," OCO : ",OCO," BEPips : ",BEPips," Money Management : ",mm," RiskPercent: ",RiskPercent," Lots : ",LotsOptimized());
  
   if ((secofday<secofnews) && (secofday>(secofnews-SecBPO))) {
     
      if (OrdersCondition==0) {
         Write("Opening BuyStop & SellStop, OrdersCondition="+OrdersCondition+" SecOfDay="+secofday);
         OpenBuyStop();
         OpenSellStop();
      }

      if (OrdersCondition==10) {
         Write("Opening SellStop, OrdersCondition="+OrdersCondition+" SecOfDay="+secofday);
         OpenSellStop();
      }
     
      if (OrdersCondition==1) {
         Write("Opening BuyStop , OrdersCondition="+OrdersCondition+" SecOfDay="+secofday);
         OpenBuyStop();
      }
   }

   if ((secofday<secofnews) && (secofday>(secofnews-SecBPO)) && (secofday<(secofnews-SecBMO))) {
         Write("Modifying Orders, OrdersCondition="+OrdersCondition+" SecOfDay="+secofday);
         DoModify();
      }
     
  

   if ((secofday>secofnews) && (secofday<(secofnews+STWAN)) && OCO) {

      if (OrdersCondition==1001) {
         Write("Deleting SellStop Because of BuyStop Hit, OrdersCondition="+OrdersCondition+" SecOfDay="+secofday);
         DeleteSellStop();
      }
     
      if (OrdersCondition==110) {
        Write("Deleting BuyStop Because of SellStop Hit, OrdersCondition="+OrdersCondition+" SecOfDay="+secofday);
        DeleteBuyStop();
      }
   }
  
   if ((secofday>secofnews) && (secofday>(secofnews+STWAN))) {
      if (OrdersCondition==11) {
         Write("Deleting BuyStop and SellStop Because 4 min expired, OrdersCondition="+OrdersCondition+" SecOfDay="+secofday);
         DeleteBuyStop();
         DeleteSellStop();
      }
     
      if ((OrdersCondition==10) || (OrdersCondition==110)) {
        Write("Deleting BuyStop Because expired, OrdersCondition="+OrdersCondition+" SecOfDay="+secofday);
        DeleteBuyStop();
      }
     
      if ((OrdersCondition==1) || (OrdersCondition==1001)) {
        Write("Deleting SellStop Because expired, OrdersCondition="+OrdersCondition+" SecOfDay="+secofday);
        DeleteSellStop();
      }
   }
       
  
//----
   return(0);
  }
 
//+------------------------------------------------------------------+
//| return error description                                         |
//+------------------------------------------------------------------+
string ErrorDescription(int error_code)
  {
   string error_string;
//----
   switch(error_code)
     {
      //---- codes returned from trade server
      case 0:
      case 1:   error_string="no error";                                                  break;
      case 2:   error_string="common error";                                              break;
      case 3:   error_string="invalid trade parameters";                                  break;
      case 4:   error_string="trade server is busy";                                      break;
      case 5:   error_string="old version of the client terminal";                        break;
      case 6:   error_string="no connection with trade server";                           break;
      case 7:   error_string="not enough rights";                                         break;
      case 8:   error_string="too frequent requests";                                     break;
      case 9:   error_string="malfunctional trade operation";                             break;
      case 64:  error_string="account disabled";                                          break;
      case 65:  error_string="invalid account";                                           break;
      case 128: error_string="trade timeout";                                             break;
      case 129: error_string="invalid price";                                             break;
      case 130: error_string="invalid stops";                                             break;
      case 131: error_string="invalid trade volume";                                      break;
      case 132: error_string="market is closed";                                          break;
      case 133: error_string="trade is disabled";                                         break;
      case 134: error_string="not enough money";                                          break;
      case 135: error_string="price changed";                                             break;
      case 136: error_string="off quotes";                                                break;
      case 137: error_string="broker is busy";                                            break;
      case 138: error_string="requote";                                                   break;
      case 139: error_string="order is locked";                                           break;
      case 140: error_string="long positions only allowed";                               break;
      case 141: error_string="too many requests";                                         break;
      case 145: error_string="modification denied because order too close to market";     break;
      case 146: error_string="trade context is busy";                                     break;
      //---- mql4 errors
      case 4000: error_string="no error";                                                 break;
      case 4001: error_string="wrong function pointer";                                   break;
      case 4002: error_string="array index is out of range";                              break;
      case 4003: error_string="no memory for function call stack";                        break;
      case 4004: error_string="recursive stack overflow";                                 break;
      case 4005: error_string="not enough stack for parameter";                           break;
      case 4006: error_string="no memory for parameter string";                           break;
      case 4007: error_string="no memory for temp string";                                break;
      case 4008: error_string="not initialized string";                                   break;
      case 4009: error_string="not initialized string in array";                          break;
      case 4010: error_string="no memory for array\' string";                             break;
      case 4011: error_string="too long string";                                          break;
      case 4012: error_string="remainder from zero divide";                               break;
      case 4013: error_string="zero divide";                                              break;
      case 4014: error_string="unknown command";                                          break;
      case 4015: error_string="wrong jump (never generated error)";                       break;
      case 4016: error_string="not initialized array";                                    break;
      case 4017: error_string="dll calls are not allowed";                                break;
      case 4018: error_string="cannot load library";                                      break;
      case 4019: error_string="cannot call function";                                     break;
      case 4020: error_string="expert function calls are not allowed";                    break;
      case 4021: error_string="not enough memory for temp string returned from function"; break;
      case 4022: error_string="system is busy (never generated error)";                   break;
      case 4050: error_string="invalid function parameters count";                        break;
      case 4051: error_string="invalid function parameter value";                         break;
      case 4052: error_string="string function internal error";                           break;
      case 4053: error_string="some array error";                                         break;
      case 4054: error_string="incorrect series array using";                             break;
      case 4055: error_string="custom indicator error";                                   break;
      case 4056: error_string="arrays are incompatible";                                  break;
      case 4057: error_string="global variables processing error";                        break;
      case 4058: error_string="global variable not found";                                break;
      case 4059: error_string="function is not allowed in testing mode";                  break;
      case 4060: error_string="function is not confirmed";                                break;
      case 4061: error_string="send mail error";                                          break;
      case 4062: error_string="string parameter expected";                                break;
      case 4063: error_string="integer parameter expected";                               break;
      case 4064: error_string="double parameter expected";                                break;
      case 4065: error_string="array as parameter expected";                              break;
      case 4066: error_string="requested history data in update state";                   break;
      case 4099: error_string="end of file";                                              break;
      case 4100: error_string="some file error";                                          break;
      case 4101: error_string="wrong file name";                                          break;
      case 4102: error_string="too many opened files";                                    break;
      case 4103: error_string="cannot open file";                                         break;
      case 4104: error_string="incompatible access to a file";                            break;
      case 4105: error_string="no order selected";                                        break;
      case 4106: error_string="unknown symbol";                                           break;
      case 4107: error_string="invalid price parameter for trade function";               break;
      case 4108: error_string="invalid ticket";                                           break;
      case 4109: error_string="trade is not allowed";                                     break;
      case 4110: error_string="longs are not allowed";                                    break;
      case 4111: error_string="shorts are not allowed";                                   break;
      case 4200: error_string="object is already exist";                                  break;
      case 4201: error_string="unknown object property";                                  break;
      case 4202: error_string="object is not exist";                                      break;
      case 4203: error_string="unknown object type";                                      break;
      case 4204: error_string="no object name";                                           break;
      case 4205: error_string="object coordinates error";                                 break;
      case 4206: error_string="no specified subwindow";                                   break;
      default:   error_string="unknown error";
     }
//----
   return(error_string);
  } 
//+------------------------------------------------------------------+
Lapas:12next
Forumu saraksts/Hard & Soft/Palīdziet ar skriptu MT4 platformai!!!
© 2004-2024 wallstreet.lv
e-mail: 
Pārpublicēšanas gadījumā atsauce uz wallstreet.lv obligāta!
Top.LV