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

 
T-G:
Please give me a function to calculate the maximum permissible opening lot on the deposit, taking into account the open positions (equity). Thank you in advance.

double maxlot = MarketInfo(Symbol(), MODE_MAXLOT);

double requiredlots = AccountFreeMargin() / MarketInfo(Symbol(), MODE_MARGINREQUIRED);

maxlot = MathMin(maxlot, requiredlots); // Максимальный объем, на который можно открыться

// Далее необходимо maxlot нормализовать под спецификацию контрактов, прежде чем вставлять в приказ
 

Greetings.

Help me identify this turkey: http://findicators.com/wp-content/uploads/2009/04/heiken-ashi.jpg

It is claimed to be a heiken ashi, but even a cursory calculation breaks the pattern. Perhaps someone knows what it is?

Respectfully.

 
ns88ns:

Greetings.

Help me identify this turkey: http://findicators.com/wp-content/uploads/2009/04/heiken-ashi.jpg

It is claimed to be a heiken ashi, but even a cursory calculation breaks the pattern. Perhaps someone knows what it is?

Respectfully.


The very same, or rather a modification of it. It's built by the mashqs
 
Vinin:

It is, or rather its modification. It builds on the scales.


Thank you...

I figured it out... I just don't understand, in this case the HA is smeared on the MA, or in some other way... Well, it's not important.

 
Help me to modify the indicator to a semi-automatic.

I draw a simple line manually and name it Trendline 42864 for example. How can I make it so that when I create another line, the code will rename each created line, repaint it, set the thickness, etc.

What do I need it for? I have an indicator, I need to turn it into a semi-automatic indicator. I.e. I draw a trend line manually, the code should repaint it and draw another dev lines, vertical and horizontal. I also need it to draw each of them.

The indicator is attached. The principle, we draw a line on two points, when the double distance across these two points is passed, the line ends and the trend stops and goes into uncertainty. I want to say right away that we should not try to create an automatic machine by this line at this stage. I need a semi-automatic for now.

Files:
 

Afternoon. When trying to modify two orders simultaneously, for sell - set sl..,

If I try to modify only a sell order and a buy order, I can't see the buy order. Please, advise what may be the

be the reason?

void FirstSellLockBuyModifi()
{
 double lock_buy_tp = NormalizeDouble((FirsSellLockBuyAvP()+TakeProfit*Point),Digits);
 int spread = MarketInfo(Symbol(),MODE_SPREAD);
 double first_sell_sl = NormalizeDouble((lock_buy_tp+spread*Point),Digits);        
 for (int i = 0; i <= OrdersTotal(); i ++)
    {
     OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
     if (OrderSymbol()!=Symbol())continue;
     if (OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)
     if (OrderType()==OP_SELL && OrderOpenPrice()==FirstSellPrice())
       {Print("Мод-ция ордера FIRST SELL");
        OrderModify(OrderTicket(),OrderOpenPrice(),first_sell_sl,OrderTakeProfit(),0,CLR_NONE);
        error=GetLastError();
        if (error != 0) Print("Мод-ция ордера FIRST SELL № ",OrderTicket()," ошибка № ",error);
       }
     if (OrderType()==OP_BUY)
       {Print("Мод-ция ордера LOCK BUY");
        OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),lock_buy_tp,0,CLR_NONE);
        error=GetLastError();
        if (error != 0) Print("Мод-ция ордера LOCK BUY № ",OrderTicket()," ошибка № ",error);
       }
    }
 return(0);
}
 
TEXX:

Afternoon. When trying to modify two orders simultaneously, for sell - set sl..,

If I try to modify only a sell order and a buy order, I can't see the buy order. Please, advise what may be the

be the reason?

It is quite possible that it is here?

for (int i = 0; i <= OrdersTotal(); i ++)

It is not clear why there is a space before ++?

But the main mistake is to modify more than one order at the same time. The server will not be able to execute it, because when trying to modify the second order, the trade thread will be closed. Although in the tester, such situation can be handled without any problems.

 
TEXX:

Afternoon. When trying to modify two orders simultaneously, for sell - set sl..,

If I try to modify only a sell order and a buy order, I can't see the buy order. Please, advise what may be the

be the reason?

     
 for (int i = 0; i <= OrdersTotal(); i ++)  // 1 ошибка
  
     OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
     if (OrderSymbol()!=Symbol())continue; // нет смысла
     if (OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)  // после неё нет открывающейся скобки
  
   if (OrderType()==OP_SELL && OrderOpenPrice()==FirstSellPrice())
       {Print("Мод-ция ордера FIRST SELL");
        OrderModify(OrderTicket(),OrderOpenPrice(),first_sell_sl,OrderTakeProfit(),0,CLR_NONE);
        error=GetLastError();
        if (error != 0) Print("Мод-ция ордера FIRST SELL № ",OrderTicket()," ошибка № ",error);
       }

     if (OrderType()==OP_BUY)
       {Print("Мод-ция ордера LOCK BUY");
        OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),lock_buy_tp,0,CLR_NONE);
        error=GetLastError();
        if (error != 0) Print("Мод-ция ордера LOCK BUY № ",OrderTicket()," ошибка № ",error);
       }

What error does it give out?
 
sergeev:
What error does it give out?


that's the point, there are no errors, just buy does not modify and that's it, but if sell is commented out, then modify....
 

A negative result is also a result and is no less important, but if you see the following picture (on the pound, the total loss from 100 000 to 2000 with 1 lot) ...... is it reasonable to rewrite the buy on sell, stop on profit, etc.?

Your opinion?