[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 334

 
khorosh:
What is the difference between POINT and TICKSIZE ? When you query through MarketInfo() they are the same, but why should they be different if they have different names?
What is the difference between POINT and TICKSIZE site:mql4.com
 
khorosh:
What is the difference between POINT and TICKSIZE ? When queried through MarketInfo() they are the same, but should they be different if they have different names?

Sometimes they are different for individual instruments
 
Vinin:

Sometimes there is a difference for individual instruments
Thank you. A point is like a penny-unit of measure. Tixais is the minimum change in price. Apparently tixies can't be less than a pip and more. I guess it is up to the BC to decide.
 
Can you please tell me if it is possible to run a macro from MQL in an EXCEL book (it is open)?
 
rustein:
How do I calculate the maximum allowable lot size with leverage etc.?
Thank you
double MeansOneLot       = MarketInfo(Symb,MODE_MARGINREQUIRED);      //Необходимо средств для открытия 1 лота
double MeansFree         = AccountFreeMargin();                       //Значение свободных средств, разрешенных для открытия позиций
double MeansGuaranty     = AccountMargin();                           //Значение залоговых средств, используемых для поддержания открытых позиций
double LotPriceTic       = MarketInfo(Symb, MODE_TICKVALUE);          //Стоимость 1 лота в валюте депо на 1 тик
double MaxLotPermissible = MathFloor((MeansFree/MeansOneLot)*100)/100;//Максимально допустимый лот для открытия позиции
 
joo:

Thank you very much.
 

HELP TO ATTACH THE FILE TO THE TEXT

 
Friends, help me solve a problem... I have ticket numbers written to TicketArray array (there are 3 of them). So, I want my EA to stop trading when I get a loss 3 times in a row... For starters, I cannot write the condition of 3 lots... The Good Serpent once gave me some knowledge about flags and I am using them now, but it still does not work. After the first order closes in loss, it turns true, and then it works fine... Why?

bool flag = true; //по умолчанию флаг стоит на правду
for(int j=1;j<4;j++) //цикл из 3х значений (1,2,3)
{
OrderSelect(TicketArray[j],SELECT_BY_TICKET); //выбираю ордер

if(OrderClosePrice()!=OrderStopLoss() && TicketArray[j]==0)flag = false; //думаю, тут проблема. Условие: если ордер не получил лося 3 раза и если у тикета еще нет номера, то такая ситуация меня не устраивает.
Print(OrderClosePrice(),",,,,,",OrderStopLoss(),",,,,,",TicketArray[j]); //эта строчка для тестера, чтоб наглядно было видно цену закрытия, цену стопа и номер тикета. Хоть тикет и =0, но все равно пишет true.
}
Alert(flag);

I am pasting the entire EA just in case. This is an ordinary martingale, which I wrote myself for educational purposes.

//+------------------------------------------------------------------+
//| StMartin.mq4 |
//| Sergey Kodolov |
//| 84232676421@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Sergey Kodolov"
#property link "84232676421@mail.ru"

extern int TP = 1000; 
extern int TS = 1000; 
extern int TF = 1; 
extern double lots = 0.1; 


double volumz;
int ticket,total;
int slip = 3; 
int Magic = 4; 

int TicketArray[4];

void FormTicket(int number) //объявил шаблон под функцию запоминания тикетов
{
for(int i=3;i>0;i--)
{
TicketArray[0] = ticket;
if(TicketArray[0]>0 && TicketArray[0] == TicketArray[1])break;
TicketArray[i] = TicketArray[i-1];
} 
}

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
ticket = OrderSend(Symbol(),OP_BUY,lots,Ask,slip,Bid-TS*Point,Bid+TP*Point,"First order",Magic,0,Yellow); //открываем первый ордер
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
int OrderTimeCheck = check3(); //проверяем, закрыт ли ордер
bool OrderCloseCheck = check2(OrderTimeCheck); //проверяем, закрылись ли ордера в минус
FormTicket(ticket); //вызываем функцию, чтоб запоминала тикеты
ProfitCheck(OrderCloseCheck); //тут рисуем линии

total = OrdersTotal();
if(total < 1)
{
OrderSelect(TicketArray[1],SELECT_BY_TICKET);
volumz = OrderLots();
if(OrderProfit()<=0)
{
if(OrderType() == OP_BUY)
{ 
double lot1 = volumz*2;
ticket = OrderSend(Symbol(),OP_SELL,lot1,Bid,slip,Ask+TS*Point,Ask-TP*Point,0,Magic,0,Green);
}
if(OrderType() == OP_SELL)
{ 
double lot2 = volumz*2;
ticket = OrderSend(Symbol(),OP_BUY,lot2,Ask,slip,Bid-TS*Point,Bid+TP*Point,0,Magic,0,Red);
}
}
if(OrderProfit()>0)
{
if(OrderType() == OP_BUY)
{
ticket = OrderSend(Symbol(),OP_BUY,lots,Ask,slip,Bid-TS*Point,Bid+TP*Point,0,Magic,0,Green);
}
if(OrderType() == OP_SELL)
{
ticket = OrderSend(Symbol(),OP_SELL,lots,Bid,slip,Ask+TS*Point,Ask-TP*Point,0,Magic,0,Red);
}
} 

} 
//----
return(0);
}
//+------------------------------------------------------------------+


int check3() //проверяем, закрыт ли ордер
{
OrderSelect(TicketArray[1],SELECT_BY_TICKET);
if(OrderCloseTime()>0)return(100);
}

bool check2(int OrderTimeCheck) //проверяем, если ордер закрыт, то последние 3 закрытых ордера были ли убыточными?
{
if(OrderTimeCheck == 100)
{
bool flag = true;
for(int j=1;j<4;j++)
{
OrderSelect(TicketArray[j],SELECT_BY_TICKET);

if(OrderClosePrice()!=OrderStopLoss() && TicketArray[j]==0)flag = false; //ТУТ ДОДУМАТЬ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Print(OrderClosePrice(),",,,,,",OrderStopLoss(),",,,,,",TicketArray[j]);
}
Alert(flag);
if(flag == true)
{
ObjectCreate("NewLabel",OBJ_LABEL,0,0,0);
ObjectSetText("NewLabel","Ура",14,"Arial",Aqua);
ObjectSet("NewLabel", OBJPROP_CORNER,1);
ObjectSet("NewLabel", OBJPROP_XDISTANCE,40);
ObjectSet("NewLabel", OBJPROP_YDISTANCE,40);
}
} 
}

void ProfitCheck(bool OrderCloseCheck)
{
if(OrderCloseCheck == true) 
{
Print("x");
} 
} 
 

Can't read one of the PerkyAsctrend1 indicator buffers.
Please help me to figure it out. I have done it many times with other indicators, always without problems. I cannot do it here.
I read two buffers: one of them:
double PerkyBuf2=iCustom (NULL,0," PerkyAsctrend1 ",5,250,0,1); - reads correctly, the signal is caught, next line tries to catch:
double PerkyBuf1=iCustom (NULL,0," PerkyAsctrend1 ",5,250,1,1); but all signals in this buffer are flying past my EA. I even tried to create an empty Expert Advisor with two Comment() points with results. I cannot get a signal for sell.
Can you help me understand it.
I would like to attach indicator
Files:
 
Qoren:

Can't read one of the PerkyAsctrend1 indicator buffers.
Please help me to understand it. I have done it many times with other indicators, always without problems. But it is not working here.
I read two buffers: one of them:
double PerkyBuf2=iCustom (NULL,0," PerkyAsctrend1 ",5,250,0,1); - reads correctly, the signal is caught, next line tries to catch:
double PerkyBuf1=iCustom (NULL,0," PerkyAsctrend1 ",5,250,1,1); and all signals of this buffer fly past my EA. I even tried to create an empty Expert Advisor with two Comment() points with results. I cannot get a signal for sell.
Can you help me understand it.
I would like to attach indicator

Signal for Buy in buffer 0, signal for Sell in buffer 1

Script to test:

//+------------------------------------------------------------------+
//|                                                         Test.mq4 |
//|                             Copyright © 2011, Trishkin Artyom A. |
//|                                           support@goldsuccess.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, Trishkin Artyom A."
#property link      "support@goldsuccess.ru"
//                   Skype: artmedia70

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
//----
   int count=WindowBarsPerChart();
   for (int i=0; i<count; i++) {
      double buf0=iCustom(Symbol(),Period(),"PerkyAsctrend1_1",4,250,0,i);
      double buf1=iCustom(Symbol(),Period(),"PerkyAsctrend1_1",4,250,1,i);
      if (buf0!=EMPTY_VALUE) Alert("В буфере 0 на баре ",iBarShift(Symbol(),Period(),Time[i])," сигнал на Buy = ",DoubleToStr(buf0,Digits));
      if (buf1!=EMPTY_VALUE) Alert("В буфере 1 на баре ",iBarShift(Symbol(),Period(),Time[i])," сигнал на Sell = ",DoubleToStr(buf1,Digits));
      }
//----
   return(0);
  }
//+------------------------------------------------------------------+