Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 802

 
gyfto:
I vaguely suspect not. I'll write back tomorrow, I'm at work now.
Will only help by trending bars in the subwindow. But we need to intercept the scale value somehow. How?
 
Who knows if it is possible to modify the TakeProfit of an open order to the minus zone if the trade is in the minus zone?
 
woin2110:
Who knows, is it possible to modify the TakeProfit of an open order to the minus zone if the trade is in the minus zone?
of course you can.
 
Hello. i just started to write an EA a couple of days ago. i have programming experience, but i have not done any programming in MQL4 yet. i have a lot to learn, so i need some tips on how to do it. for example i want to open an order at 0.01 lot and i need to set takeprofit to earn 0.5 lot. please show me the correct way.
 

While I was waiting for an answer, I searched and found something and made this. Will it display correctly? It's Sunday and I don't want to wait until midnight to find out if I wrote it correctly.


  if(Count ==0)
        symbol = Symbol();
        
   double bid   =MarketInfo(symbol,MODE_BID); // Запрос значения Bid
   double ask   =MarketInfo(symbol,MODE_ASK); // Запрос значения Ask
   double point =MarketInfo(symbol,MODE_POINT);//Запрос Point  
   double  value =MarketInfo(OrderSymbol(), MODE_TICKVALUE);// Размер минимального изменения цены инструмента в валюте депозита
   double stoplevel = MarketInfo(symbol,MODE_STOPLEVEL);
   double digits =   MarketInfo(symbol,MODE_DIGITS);


   
   if( bid<= stoploss1||step1 == 0)
   {
      step1++;
      stoplevel= NormalizeDouble(stoplevel*point,digits);
      stoploss1 = ask-stoplevel;
      takeprofit1 = ask+stoplevel;

 
      double profit =0.5;
      double takeprofit2= profit * point * value * lot1 + bid;
      takeprofit2 = NormalizeDouble(takeprofit2,digits);
      if (takeprofit2 > takeprofit1)
         takeprofit1 = takeprofit2;


 
pycha:

While I was waiting for an answer, I searched and found something and made this. Will it display correctly? It's Sunday and I don't want to wait until midnight to find out if I wrote it correctly.


  if(Count ==0)
        symbol = Symbol();
        
   double bid   =MarketInfo(symbol,MODE_BID); // Запрос значения Bid
   double ask   =MarketInfo(symbol,MODE_ASK); // Запрос значения Ask
   double point =MarketInfo(symbol,MODE_POINT);//Запрос Point  
   double  value =MarketInfo(OrderSymbol(), MODE_TICKVALUE);// Размер минимального изменения цены инструмента в валюте депозита
   double stoplevel = MarketInfo(symbol,MODE_STOPLEVEL);
   double digits =   MarketInfo(symbol,MODE_DIGITS);


   
   if( bid<= stoploss1||step1 == 0)
   {
      step1++;
      stoplevel= NormalizeDouble(stoplevel*point,digits);
      stoploss1 = ask-stoplevel;
      takeprofit1 = ask+stoplevel;

 
      double profit =0.5;
      double takeprofit2= profit * point * value * lot1 + bid;
      takeprofit2 = NormalizeDouble(takeprofit2,digits);
      if (takeprofit2 > takeprofit1)
         takeprofit1 = takeprofit2;



Isn't it easier?

 if(OrderProfit() > 0.5) OrderClose();

.

 
I need to calculate a profit before opening an order, so that it can be set immediately when the order is created.
 
I will use this programme not only to trade but also to analyse the history. I will need to calculate how many orders for the required parameters would have been open over a certain period of time. so everything needs to be calculated manually
 
pycha:
I will use this program not only for trading, but also for history analysis. I will need to calculate how many orders for the required parameters would have been open over a certain period of time. so everything needs to be calculated manually

https://www.mql5.com/ru/forum/351

.

 

Thank you, but there's still a lot I don't understand. Just tell me if this code will read correctly or not.

   double profit =0.5;
   double takeprofit2= profit * point * value * lot1 + bid;


Reason: