Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 802
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I vaguely suspect not. I'll write back tomorrow, I'm at work now.
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?
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.
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;
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.
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?
.
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 takeprofit2= profit * point * value * lot1 + bid;