Wednesday, 28 November 2012

trade history


trade history

This is a simple example to demonstrate the usage of plotNewOpenTrades() and plotNewClosedTrades() that can be found in common_functions.mqh. MT4 will not automatically plot manual trades or trades resulting from pending orders into the chart, it only plots them when an EA sends a market order.

However, we would like to see all trades in the chart and we don't want to drag them manually from the history into the chart, we would like this to happen automatically.

#property indicator_chart_window

#include <common_functions.mqh>

int start(){
   plotNewOpenTrades();
   plotNewClosedTrades();
}

The above code is a complete indicator that when put onto a chart will plot all trades (historic and currently open) into the chart and it will not interfere with the normal mechanism of MT4 plotting trades. You will not end up with duplicate objects in the chart when you already dragged a trade from the history or an EA is already plotting trades. Additionally the description of the closing arrows, visible as tooltip when hovering the mouse above them, will show the resulting profit of the trade denominated in the account currency and in pips.

You can use this code in your own EAs if they use pending orders to make all trades visible to the user.

Below you can download a compiled version of the above code, ready to put into the indicators folder and to be used as indicator on your charts.

https://sites.google.com/site/prof7bit/common_functions/trade_history

Tuesday, 27 November 2012

It's bollinger Brand MQL Code


//+------------------------------------------------------------------+
//| Bollinger MA Price.mq4 |
//| Paladin80 |
//| forevex@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Paladin80"
#property link "forevex@mail.ru"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 LightSeaGreen
#property indicator_color2 LightSeaGreen
#property indicator_color3 LightSeaGreen
//---- indicator parameters
extern int BandsPeriod=20;
extern int BandsShift=0;
extern double BandsDeviations=2.0;
extern int MA_method=0;
extern int Applied_price=0;
bool error=false;
      /* MA_method: 0 - Simple moving average,
          1 - Exponential moving average,
          2 - Smoothed moving average,
          3 - Linear weighted moving average.
          Applied_price: 0 - Close price,
          1 - Open price,
          2 - High price,
          3 - Low price,
          4 - Median price,
          5 - Typical price,
           6 - Weighted close price, 
       */
//---- buffers
double MovingBuffer[];
double UpperBuffer[];
double LowerBuffer[];

Function to calculate total lots opened


Function to calculate total lots opened

Here is the code fuction which will return the total number of lots which are currently running in open trades :

Parameters: key is magic number, and type is the type of trades .


Code:
double gettotallot(int _key, int type)
{
double _lot=0;
 for(int k=OrdersTotal(); k>=0; k--)
                {  
                  if (OrderSelect(k,SELECT_BY_POS,MODE_TRADES)&& OrderSymbol()==Symbol()&& OrderMagicNumber()==_key && OrderType()==type)
                  _lot+=OrderLots();
                  } 
              return(_lot); 
 }

day of the week

Here is code function which can be used say when ea needs to trade only during certain hours of the day and skip of certain day of the week :

Code:
  bool ValidTime() 
  {
   if (DayOfWeek()==1 && Hour()<=6) return(false);  
    return(true);
   }

CloseAllTrade Script



Here is a code which can be saved as a script file in the Scripts Folder.

To execute the script, drage and drop the script on the current chart, this will close all open trades and also pending orders of all symbols.

 int start()
{
   double total;
   int cnt;
   while(OrdersTotal()>0)
   {
      // close opened orders first
      total = OrdersTotal();
      for (cnt = total ; cnt >=0 ; cnt--)
      {
         if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) 
         {
            switch(OrderType())
            {
               case OP_BUY       :
                  RefreshRates();
                  OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),3,Violet);break;
                   
               case OP_SELL      :
                  RefreshRates();
                  OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),3,Violet); break;
            }             
         }
      }
      // and close pending
      total = OrdersTotal();      
      for (cnt = total ; cnt >=0 ; cnt--)
      {
         if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) 
         {
            switch(OrderType())
            {
               case OP_BUYLIMIT  :OrderDelete(OrderTicket()); break;
               case OP_SELLLIMIT :OrderDelete(OrderTicket()); break;
               case OP_BUYSTOP   :OrderDelete(OrderTicket()); break;
               case OP_SELLSTOP  :OrderDelete(OrderTicket()); break;
            }
         }
      }
   }
   return(0);
}

Code to take Screenshot of Chart and save it to local drive



Here is the Code that you can put in any EA to take a screenshot of the Chart and save it to disk, you can call this on any event like if there is any new trade taken, you can save the screenshot.


the system function to take screenshot is:
Code:
WindowScreenShot(filename,size_x,size_y)

Here is the example usage:

Code:
string filename= "Chart"+Symbol();
WindowScreenShot(filename,570,428)

The above will save the chart with name "ChartEURUSD". You can make the filename very dynamic so every time screenshot is taken, it would save it with different name.

Numeric Chart Period to Text String Format



Here is the code function that will return the chart period in the nicely formation text line.

Example: (if EA is running on 1hour chart)

chartperiod = periodToString(Period()) // will return 1 Hour


Code:
string periodToString(int tf) 
{
   string tfString;
   
   switch (tf)  
   {   
      case 1:      tfString = "1 Min";    break;
      case 5:      tfString = "5 Min";    break;
      case 15:     tfString = "15 Min";   break;  
      case 30:     tfString = "30 Min";   break;  
      case 60:     tfString = "1 Hour";   break;  
      case 240:    tfString = "4 Hour";   break;  
      case 1440:   tfString = "Daily";    break;  
      case 10080:  tfString = "Weekly";   break;  
      case 40320:  tfString = "Monthly";  break;  
      default:     tfString = "Unknown";   
   }

  
   return (tfString);
}

Close All Function



This function will close All open trades for a particual MagicNumber of EA.

Code:
void CloseAll()
{
  int total = OrdersTotal();
  for(int i=total-1;i>=0;i--)
  {
    OrderSelect(i, SELECT_BY_POS);
    int type = OrderType();
    
    if (OrderSymbol()==Symbol() && (OrderMagicNumber() == MagicNumber))  
    {
      //-- Close open BUYs
      if (type == OP_BUY) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),Slippage,CornflowerBlue);
      //-- Close open SELLS
      if (type == OP_SELL) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),Slippage,CornflowerBlue);
    }
  }
  return;
}

Count All Open Trades



Following is a custom function which when called will return total of active trades for a particular magic number:


Code:
int CountAllTrades(int magic) {
   int c=0;
   for (int j=OrdersTotal()-1;j>=0;j--)
   {
      OrderSelect(j,SELECT_BY_POS,MODE_TRADES);
      if (OrderSymbol()==Symbol() && OrderMagicNumber()==magic) c++;
   }
   
   return(c);
}

the Broker is 4 digits or 5 digits pricing

Here is a code which you can use in an Expert Advisors to automatically adjust variables depending on if the Broker is 4 digits or 5 digits pricing. 

following code should be inside the int Init() function

Code:
if(Digits==5 || Digits==3){ 
            StopLoss= Stoploss * 10;   // this adjusts Stoploss variable for 5digit broker
}

Friday, 23 November 2012

EA Stochastic - Instant order


//+------------------------------------------------------------------+
//|                                       Copyright © 2011, vgtechFX |
//|                                          [url]http://www.vgtechFX.com[/url] |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, vgtechFX"
#property link      "http://www.vgtechFX.com"

extern double xLotSize = 1;
extern double xTakeProfit = 10;
extern double xMGN = 112233;
datetime sudahordersell,sudahorderbuy;


//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
 
  //---- don't remove this line
        if(ObjectFind("CC")!=0) ObjectCreate("CC", OBJ_LABEL, 0, 0, 0);
        ObjectSet("CC", OBJPROP_CORNER, 3);
        ObjectSet("CC", OBJPROP_XDISTANCE, 5);
        ObjectSet("CC", OBJPROP_YDISTANCE, 5);
        ObjectSet("CC", OBJPROP_BACK, true);
        ObjectSetText("CC","Expert Advisor Copyright © "+Year()+", vgtechFX.Com", 13, "Arial", Silver);
   //----

   if(SignalBuy()==true && sudahorderbuy !=Time[0] )
   {
      OrderBuy();
   }
 
  if(SignalSell()==true && sudahordersell !=Time[0] )
   {
      OrderSell();
   }
   return(0);
  }
//+------------------------------------------------------------------+

bool SignalBuy()
{
   bool EntryBuy = false;
   double BandHigh   = iBands(NULL,0,20,1.5,0,PRICE_LOW,MODE_UPPER,2);
   double BandLow    = iBands(NULL,0,20,1.5,0,PRICE_LOW,MODE_LOWER,2);
 
 
   double ValueStoch = iStochastic(NULL,0,10,5,5,MODE_SMA,0,MODE_MAIN,0);
   double ValueStoch1 = iStochastic(NULL,0,10,5,5,MODE_SMA,0,MODE_SIGNAL,0);
 
   if(Close[2] < BandLow &&  Open[1] < Close[1]
      && ValueStoch < 10  && ValueStoch1 < 10

     )
   {
      EntryBuy = true;
   }else{
      EntryBuy = false;
   }
 
   return(EntryBuy);

}

bool SignalSell()
{
   bool EntrySell = false;
   double BandHigh   = iBands(NULL,0,20,1.5,0,PRICE_LOW,MODE_UPPER,2);
   double BandLow0    = iBands(NULL,0,20,1.5,0,PRICE_LOW,MODE_LOWER,2);
 
 
   double ValueStoch = iStochastic(NULL,0,10,5,5,MODE_SMA,0,MODE_MAIN,0);
   double ValueStoch1 = iStochastic(NULL,0,10,5,5,MODE_SMA,0,MODE_SIGNAL,0);
 
   if(Close[2] > BandHigh &&  Open[1] > Close[1]
      && ValueStoch > 90       && ValueStoch1 > 90

   )
   {
      EntrySell = true;
   }else{
      EntrySell = false;
   }
 
   return(EntrySell);

}


void OrderBuy()
{
int ticketbuy;
ticketbuy=OrderSend(Symbol(),OP_BUY,xLotSize,Ask,3,0,Ask + xTakeProfit*Point,"Order Jam : " + Hour() ,xMGN,0,Blue);
      if(ticketbuy > 0)
      {
         sudahorderbuy = Time[0];
      }

}



void OrderSell()
{
int ticketsell;
ticketsell=OrderSend(Symbol(),OP_SELL,xLotSize,Bid,3,0,Bid - xTakeProfit*Point,"Order Jam : " + Hour(),xMGN,0,Red);
      if(ticketsell>0)
      {
         sudahordersell = Time[0];
      }
}

Monday, 12 November 2012

EA nya dibikin OP nya manual


apakah ada yang bisa bantu coding,

gimana kalo EA nya dibikin OP nya manual, setelah floating EA nya baru bekerja

supaya kita bisa mengatur arah nya
ane sih belum pernah pakei EA ini master
tapi kalau mau digunakan sebagai penerus op manual kaya ea servantavg, mungkin bisa diotak atik bagian trigernya atau bagian yang menyebabkan EA buka order buy atau order sell
Nah pada bagian triger tsb di kasih boolian pada deklasrasi
extern bool buy= false;
extern bool sell=false;

di triger op
if(buy && ...........disini biasaya logika buynya ) ordersend(....OP_buy...);
demikian juga pada sellnya

cara lain kalau ea ada pengaturan jam trading atur supaya kalau dipake mau trading manual = diseting jamnya diluar jam trading sehingga EA td OP
biasanya EA diatur berdasarka magicnumber = untuk manual gunakan angka 0; atau Op bisa digunakan script dengan disamakan magicnumberny 
emang tdiak semua ea diatur dg magicnumber kadang ada yg menggunakan comment (ordercomment)

Friday, 9 November 2012

Cara protect EA



1. Password protection code:
Metode ini banyak di gunakan untuk memprotect EA.
Cara kerjanya dengan memberikan password untuk melock ea kita. Code ini dapat digunakan:
int start()
{extern string Please_Enter_Password = "0";// your code here....int start()
{if (password != "indo.mt5") //change to the password you give the user!
{Alert ("Wrong password!");return (0); }// your code here....}
Pada code diatas password yang digunakan adalah “indo.mt5″ dimana sudah di tuliskan di dalam MQL4 file dan kita hanya tinggal mengcompile program kita.
2. Trial period protection:
Memberikan batas waktu bagi user sehingga bila mencapai limit waktu penggunaan maka EA tidak dapat berfungsi lagi.
int start()
{string expire_date = "2006.31.06"; //<-- hard coded datetimedatetime e_d = StrToTime(expire_date);
if (CurTime() >= e_d){Alert ("The trial version has been expired!");return(0);}// your normal code!return(0);}
3. Limited account number protection:
Digunakan untuk menglock penggunaan EA pada account tertentu saja.
int start()
{
int hard_accnt = 11111; //<-- type the user account here before compilingint accnt = AccountNumber();
if (accnt != hard_accnt){Alert ("You can not use this account (" + DoubleToStr(accnt,0) + ") with this program!");return(0);}// your normal code!return(0);}
4. Limited account type protection:
Cara ini membatasi user hanya pada demo account saja.
int start()
{
bool demo_account = IsDemo();
if (!demo_account){Alert ("You can not use the program with a real account!");return(0);}// your normal code!return(0);}
5. DLL protection:
Metode ini dengan menuliskan DLL dan di export ke dalam MQL4 kita.
SEMUA EA INDI DAN SCRIPT SAYA KUMPULKAN DARI FORUM” TERBUKA, NAMUN APABILA ADA KETIDAKNYAMANAN SAYA MOHON MAAF

ANEKA SCRIPT ORDER DENGAN RISK MANAGEMENT


SCRIPT ORDER DENGAN RISK MANAGEMENT
::::BUY SCRIPT:::::
//+------------------------------------------------------------------+
//| Buy with MM |
//| Copyright © 2011, Rubianto |
//| Rubi_Sniper |
//+------------------------------------------------------------------+
#property copyright "Copyright © Rubi_Sniper_2011"
#property link "rubianto.md@gmail.com"
//#property show_inputs
extern double Lots = 1;
extern bool UseMoneyMgmt = true;
extern double RiskPercent = 5;
extern bool UseStop = true;
extern bool UseTakeProfit = true;
extern double StopLoss = 30;
extern double TakeProfit = 5;
extern string Note="0 in Entry field means Market Order Buy";
extern double Entry = 0.0000;
string Input = " Buy Price ";
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
double Risk = RiskPercent / 100;
if (UseMoneyMgmt)
Lots = NormalizeDouble( AccountBalance()*Risk/StopLoss/(MarketInfo(Symbol(), MODE_TICKVALUE)),2);
int Mode = OP_BUYSTOP;
if (Ask > Entry && Entry > 0) Mode = OP_BUYLIMIT;
if (Entry == 0) {Entry = Ask; Mode = OP_BUY;}
double SLB = Entry - StopLoss*Point, TPB = Entry + TakeProfit*Point;
if (UseStop == false) SLB = 0;
if (UseTakeProfit == false) TPB = 0;
if(Lots > 0)
OrderSend(Symbol(),Mode, Lots, Entry, 2,SLB , TPB, "Rubi_Sniper_BUY", 0, NULL, LimeGreen);
return(0);
}
//+------------------------------------------------------------------+
::::SELL SCRIPT::::
//+------------------------------------------------------------------+
//| Sell with MM |
//| Copyright © 2011, Rubianto |
//| Rubi_Sniper |
//+------------------------------------------------------------------+
#property copyright "Copyright © Rubi_Sniper_2011"
#property link "rubianto.md@gmail.com"
//#property show_inputs
extern double Lots = 1;
extern bool UseMoneyMgmt = True;
extern double RiskPercent = 5;
extern bool UseStop = true;
extern bool UseTakeProfit = true;
extern double StopLoss = 30;
extern double TakeProfit = 5;
extern string Note="0 in Entry field means Market Order Sell";
extern double Entry = 0.0000;
string Input = " Sell Price ";
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
double Risk = RiskPercent / 100;
if (UseMoneyMgmt)
Lots = NormalizeDouble( AccountBalance()*Risk/StopLoss/(MarketInfo(Symbol(), MODE_TICKVALUE)),2);
int Mode = OP_SELLSTOP;
if (Bid < Entry && Entry > 0) Mode = OP_SELLLIMIT;
if (Entry == 0) {Entry = Bid; Mode = OP_SELL;}
double SLS = Entry+StopLoss*Point, TPS = Entry - TakeProfit * Point;
if (UseStop == false) SLS = 0;
if (UseTakeProfit == false) TPS = 0;
if(Lots > 0)
OrderSend(Symbol(),Mode, Lots, Entry, 2, SLS, TPS, "Rubi_Sniper_SELL",0, NULL, Red);
return(0);
}
//+------------------------------------------------------------------+
Script Buy n Sell dari bos Fkipoi Rian duet Taufik Kiads
SCRIPT BUY :
//====================================================
//IA1_script_buy_multiple.mq4
//depok.investor@gmail.com
//Note: Adjust lot1,takeprofit1 and stoploss1 as u like
//build:31/10/2011 taufik
//====================================================
#property copyright "IA1_2011"
#property link "depok.investor@gmail.com"
double lot1 =1.0;
int total_entry =5;
int takeprofit1 =5;
int stoploss1 =0;
int slippage1 =5;
int repeat =1;
int start()
{
while (repeat<=total_entry)
{
buy(lot1,takeprofit1,stoploss1,slippage1);
Sleep(1000);
int err=GetLastError();
if (err==0) {repeat++;}
else {repeat=repeat;}
}
}
void buy(double lot, double tp, double sl, int slip)
{
double askprice = Ask;
if (tp>0)tp = askprice + (tp * Point);
if (sl>0)sl = askprice - (sl *Point);
OrderSend(Symbol(), OP_BUY, lot, askprice, slip, sl, tp, "IA1_Buy-"+repeat, 0, 0, Blue);
return(0);
}
SCRIPT SELL :
//====================================================
//IA1_script_sell_multiple.mq4
//depok.investor@gmail.com
//Note: Adjust lot1,takeprofit1 and stoploss1 as u like
//build:31/10/2011 taufik
//====================================================
#property copyright "IA1_2011"
#property link "depok.investor@gmail.com"
double lot1 =1.0;
int total_entry =5;
int takeprofit1 =5;
int stoploss1 =0;
int slippage1 =5;
int repeat =1;
int start()
{
while (repeat<=total_entry)
{
sell(lot1,takeprofit1,stoploss1,slippage1);
Sleep(1000);
int err=GetLastError();
if (err==0) {repeat++;}
else {repeat=repeat;}
}
}
void sell(double lot, double tp, double sl, int slip)
{
double bidprice = Bid;
if (tp>0) tp = bidprice - (tp * Point);
if (sl>0) sl = bidprice + (sl * Point);
OrderSend(Symbol(), OP_SELL, lot, bidprice, slip, sl, tp, "IA1_Sell-"+repeat, 0, 0, Red);
return(0);
}

Script Close order lengkap n muantap


##script Close order lengkap n muantap
//+------------------------------------------------------------------+
//| Close order lengkap n muantap.mq4 |
//| Oprekan by Bambang Sugianto |
//+------------------------------------------------------------------+
#property copyright "Bambang Sugianto"
#property show_inputs
#include
//+------------------------------------------------------------------+
//| input parameters: |
//+------------------------------------------------------------------+
extern bool CloseAllSymbols = false;
extern string Important = "Select one of the following:";
extern bool CloseOpenOrdersAndCancelPending = true;
extern bool CloseOpenOrders = false;
extern bool DeleteAllPendingOrders = false;
extern bool CloseOrdersWithPlusProfit = false;
extern bool CloseOrdersWithMinusProfit = false;
extern bool CloseOrdersOpenedBeforeToday = false;
//+------------------------------------------------------------------+
//| global variables to program: |
//+------------------------------------------------------------------+
double Price[2];
int giSlippage;
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
void start() {
int iOrders=OrdersTotal()-1, i;
if(CloseOpenOrdersAndCancelPending) {
for(i=iOrders; i>=0; i--) {
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) {
if ( OrderSymbol()==Symbol() || CloseAllSymbols == true ) {
if((OrderType()<=OP_SELL) && GetMarketInfo()) {
if(!OrderClose(OrderTicket(),OrderLots(),Price[1-OrderType()],giSlippage)) Print(OrderError());
}
else if(OrderType()>OP_SELL) {
if(!OrderDelete(OrderTicket())) Print(OrderError());
}
}
}
}
}
if(CloseOpenOrders) {
for(i=iOrders; i>=0; i--) {
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) {
if ( OrderSymbol()==Symbol() || CloseAllSymbols == true ) {
if((OrderType()<=OP_SELL) && GetMarketInfo()) {
if(!OrderClose(OrderTicket(),OrderLots(),Price[1-OrderType()],giSlippage)) Print(OrderError());
}
}
}
}
}
if(DeleteAllPendingOrders) {
for(i=iOrders; i>=0; i--) {
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) {
if ( OrderSymbol()==Symbol() || CloseAllSymbols == true ) {
if(OrderType()>OP_SELL) {
if(!OrderDelete(OrderTicket())) Print(OrderError());
}
}
}
}
}
else if(CloseOrdersWithPlusProfit) {
for(i=iOrders; i>=0; i--) {
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && (OrderProfit() >= 0)) {
if ( OrderSymbol()==Symbol() || CloseAllSymbols == true ) {
if((OrderType()<=OP_SELL) && GetMarketInfo()) {
if(!OrderClose(OrderTicket(),OrderLots(),Price[1-OrderType()],giSlippage)) Print(OrderError());
}
}
}
}
}
else if(CloseOrdersWithMinusProfit) {
for(i=iOrders; i>=0; i--) {
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && (OrderProfit() <= 0)) {
if ( OrderSymbol()==Symbol() || CloseAllSymbols == true ) {
if((OrderType()<=OP_SELL) && GetMarketInfo()) {
if(!OrderClose(OrderTicket(),OrderLots(),Price[1-OrderType()],giSlippage)) Print(OrderError());
}
}
}
}
}
else if( CloseOrdersOpenedBeforeToday) {
datetime tTodayStart=TimeCurrent()-TimeHour(TimeCurrent())*60*60-TimeMinute(TimeCurrent())*60;
for(i=iOrders; i>=0; i--) {
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && (OrderOpenTime() < tTodayStart)) {
if ( OrderSymbol()==Symbol() || CloseAllSymbols == true ) {
if((OrderType()<=OP_SELL) && GetMarketInfo()) {
if(!OrderClose(OrderTicket(),OrderLots(),Price[1-OrderType()],giSlippage)) Print(OrderError());
}}
else if(OrderType()>OP_SELL) {
if(!OrderDelete(OrderTicket())) Print(OrderError());
}
}
}
} Alert("beres juragan...perintah CLOSE sudah terlaksana..." ); // tambahan alert
}
//+------------------------------------------------------------------+
//| Function..: OrderError |
//+------------------------------------------------------------------+
string OrderError() {
int iError=GetLastError();
return(StringConcatenate("Order:",OrderTicket()," GetLastError()=",iError," ",ErrorDescription(iError)));
}
//+------------------------------------------------------------------+
//| Function..: GetMarketInfo |
//| Returns...: bool Success. |
//+------------------------------------------------------------------+
bool GetMarketInfo() {
RefreshRates();
Price[0]=MarketInfo(OrderSymbol(),MODE_ASK);
Price[1]=MarketInfo(OrderSymbol(),MODE_BID);
double dPoint=MarketInfo(OrderSymbol(),MODE_POINT);
if(dPoint==0) return(false);
giSlippage=(Price[0]-Price[1])/dPoint;
return(Price[0]>0.0 && Price[1]>0.0);
}