snowman647>>: у меня в советнике около 200 MA, при тестировани, когда жмешь "открыть график" они все рисуються. можно их както убрать, чтоб не видно было? спасибо
void HideTestIndicators( bool hide) The function sets flag to hide indicators called by the Expert Advisor. When the chart is opened after the test, the indicators marked with the hide flag will not be displayed in the test chart. Indicators will be flagged with the current hiding flag before each call. It should be noted that only those indicators that are directly called from the Expert Advisor under test can be shown in the testing chart.
I am trying to master the MQL language and as practice I decided to add Martingale function to my EA! I wanted to open an order with the SL by lot multiplied by the coefficient and in case of TP I would start with the original lot! I do not know how to put a condition on TP and SL! Please, advise me how to use the right code!
//--------------------------------------------------------------------externint stoploss = 50,
takeprofit = 50;
externdouble mult=2;
externdouble Lot=1;
int tip;
//--------------------------------------------------------------------int init()
{
OrderSend(Symbol(),OP_SELL,Lot,Bid,3,NormalizeDouble(Ask + stoploss*Point,Digits),
NormalizeDouble(Bid - takeprofit*Point,Digits)," ",777,Blue);
}
//--------------------------------------------------------------------int start()
{
for (int i=0; i<OrdersTotal(); i++){
if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true){
if (OrderSymbol()==Symbol()){
tip = OrderType();
Lot = OrderLots();return;}}}
if (Lot==0) return;
if (tip==0) OrderSend(Symbol(),OP_SELL,Lot*mult,Bid,3,NormalizeDouble(Ask + stoploss*Point,Digits),
NormalizeDouble(Bid - takeprofit*Point,Digits)," ",777,Blue);
if (tip==1) OrderSend(Symbol(),OP_BUY ,Lot*mult,Ask,3,NormalizeDouble(Bid - stoploss*Point,Digits),
NormalizeDouble(Ask + takeprofit*Point,Digits)," ",777,Blue);
return(0);
}
//-----------------------------------------------------------------
Kogalym>>: Пытаюсь освоить язык MQL в качестве практики решил добавить в советник перевертыш функцию Мартингейла! Что бы при SL открывал ордер лотом умноженным на коэффициент, а при TP начинал с первоночального лота! Но получилось что лот увеличивается с каждым ордером, не знаю как поставить условие на TP и SL! Подскажите пожалуйста как должен выглядеть правильный код!
Не понимаю причем там время??? По моему за наращивание лота при убытке отвечают только 3 последние строчки
This function finds the last closed order and calculates the lot based on its profit. If you have a closed order on Stop Loss, which is never positive in terms of profit, and a closed order on Take Profit, which is never negative in terms of profit, this function will work correctly. If you have a trawl of some kind, the function needs to be rewritten.
При том что функция находит последний закрытый ордер, по его профиту расчитывается лот. Если у Вас закрытый ордер по стоплоссу никогда не будет положительным по профиту, а закрытый по тейкпрофиту ордер никогда не будет отрицателен по профиту, то функция корректно отработает. Если же у Вас есть трал какой-нибудь то функцию нужно переделать.
I wrote an Expert Advisor which at TP opens an order in the same direction, and at SL opens an order in the opposite direction, but I cannot insert the Martingale function and return to the original
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Да, кажется, все проще - время сделки-то известно. Если так, то время по тайм-фрейму будет таково:
Time[iBarShift(NULL,tf,DealTime)]где
tf - нужный тайм-фрейм,
DealTime - время (с датой) сделки
Thanks, but what about if there is no deal yet and DealTime is the known time of the planned deal?
Спасибо, а как быть если сделки еще не было и DealTime - известное время планируемой сделки?
Why?))) ok. It's even simpler: tf*60*MathFloor(DealTime/60/tf) // the meaning of variables is the same
You can check the script:
===Corrected. Forgot to convert seconds to minutes.)))
can I remove them to hide them?
thanks
у меня в советнике около 200 MA, при тестировани, когда жмешь "открыть график" они все рисуються.
можно их както убрать, чтоб не видно было?
спасибо
void HideTestIndicators( bool hide)
The function sets flag to hide indicators called by the Expert Advisor. When the chart is opened after the test, the indicators marked with the hide flag will not be displayed in the test chart. Indicators will be flagged with the current hiding flag before each call.
It should be noted that only those indicators that are directly called from the Expert Advisor under test can be shown in the testing chart.
I wanted to open an order with the SL by lot multiplied by the coefficient and in case of TP I would start with the original lot!
I do not know how to put a condition on TP and SL!
Please, advise me how to use the right code!
Пытаюсь освоить язык MQL в качестве практики решил добавить в советник перевертыш функцию Мартингейла!
Что бы при SL открывал ордер лотом умноженным на коэффициент, а при TP начинал с первоночального лота!
Но получилось что лот увеличивается с каждым ордером, не знаю как поставить условие на TP и SL!
Подскажите пожалуйста как должен выглядеть правильный код!
There must be a function like this
Да уже плешь проели с этим вопросом. Набираешь old tick здесь в поисковике и читаешь, читаешь, читаешь.
If you're so smart, why do you come here? You mean you don't mind writing a sassy letter, but you don't mind replying. Well, well.
Должна быть функция вроде этой
I don't understand what the time has to do with it.I think only the last 3 lines are responsible for the lot increase in case of a loss
Не понимаю причем там время???По моему за наращивание лота при убытке отвечают только 3 последние строчки
This function finds the last closed order and calculates the lot based on its profit. If you have a closed order on Stop Loss, which is never positive in terms of profit, and a closed order on Take Profit, which is never negative in terms of profit, this function will work correctly.
If you have a trawl of some kind, the function needs to be rewritten.
При том что функция находит последний закрытый ордер, по его профиту расчитывается лот. Если у Вас закрытый ордер по стоплоссу никогда не будет положительным по профиту, а закрытый по тейкпрофиту ордер никогда не будет отрицателен по профиту, то функция корректно отработает.
Если же у Вас есть трал какой-нибудь то функцию нужно переделать.
I wrote an Expert Advisor which at TP opens an order in the same direction, and at SL opens an order in the opposite direction, but I cannot insert the Martingale function and return to the original
I cannot insert function of Martingale, I cannot return to the original lot! Maybe you can show me where this function should be placed!