Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1735

 
anrei2002 #:

The key word is HELP!

As I've written before: You'd better tell me at once that this indicator cannot be finalized on this forum!

And that's it...and I'll understand.... why so much slag was poured out???

I wrote it in the first place.

you can't fix it, it's crooked...

That was the first thing I wrote. You didn't see it, didn't realize it, thought it was bullshit.

The fact that you regard my attempt to convey to you as rubbish that you have stirred up here - I am not offended, I have not tried for your sake, someone else will read it and will not make mistakes. As for you, good luck with your indicator, look for other forums if you do not like this one.

 
Nikolay Ivanov #:

I wrote right away.

There's no way to fix it, it's crooked...

it can be fixed, but it will redraw the 8 outermost bars.

 
anrei2002 #:

The key word is HELP!

I helped you - I wrote down what you needed to do - and?)

what did you do?

 
Taras Slobodyanik #:

It can be fixed, but it will redraw the 8 outermost bars.

It was also said that the signal can be applied immediately to the 9th bar and there will be no re-drawing at all.

Taras Slobodyanik#:

i have helped you - i have written what you need to do - and?)

what did you do?

by the way, you would get (with some probability) to arbitrage, you need to agree in advance on everything that he needs to do.

Любые вопросы новичков по MQL4 и MQL5, помощь и обсуждение по алгоритмам и кодам
Любые вопросы новичков по MQL4 и MQL5, помощь и обсуждение по алгоритмам и кодам
  • 2021.11.09
  • www.mql5.com
В этой ветке я хочу начать свою помощь тем, кто действительно хочет разобраться и научиться программированию на новом MQL4 и желает легко перейти н...
 
Nikolay Ivanov #:

It was also mentioned... it was also said that you can send a signal at the 9th bar and there will be no overpricing at all... but the man does not understand

by the way, you would get to arbitrage, you have to negotiate everything in advance... what he needs cannot be done without reservations

everything is possible to do here, the man agrees to the overrides and signals 8 bars back, what's the problem?

ps. divergences and fractals also appear in the past, no big deal.
 
Taras Slobodyanik #:

Everything can be done here, the person agrees to the re-rating and the signals 8 bars back, what's the problem?

He needs to "just" remove the extra arrows and that's it. And how to do it, by re-rating or not, is your problem... This is how any arbitration starts :)

It depends on how you formulate the terms of reference, but in any case - I would not take the risk ... Even a successful arbitration is months of stress...

 
anrei2002 #:

The key word is HELP!

As I've written before: You'd better tell me at once that this indicator cannot be finalized on this forum!

And that's it...and I'll understand.... why so much slag was poured out???

Exactly. If you help do it, it means you do it, and someone helps you as much as you can and as much as you can and as much as you can.

If all you do is ask, without doing anything else, and someone does it for you, then it's a goodwill bureau.

When I created this thread, I meant help, not the production of free wishes.

 

Hello Dear forum users and experienced programmers! I need help in completing the EA)). Please advise how to add 2 things to the code advisor:

1. Here is the situation: I open an order (1st) with TP and SL and a certain lot (probably 0.01). If this order closes at take profit - cool, nothing changes. But if this (1st) order is closed at SL, the next order immediately after that (2nd) is opened with a 2 times larger lot (0.01*2=0.02). If this 2nd order is closed at Take Profit, then the next order (3rd order) is opened with a regular lot, i.e., 2 times larger lot is needed only for the next order (2nd order) after the previous (1st) was closed at SL. If the 3rd order will be closed in SL for the second time in a row, the lot will remain increased by 2x until there will be no TP close. I hope I have described in detail the logic of what needs to be added;


2. and the second thing we have to add is the SL movement. now let me explain it with an example: let's assume we have an order with basic parameters T.p. + 300, S.l. - 500. The price moves in the required direction and passes +100 pips from the opening price of the order. Once the price reaches +100 from the opening price of the order, SL should move from the base -500 to +90. I.e. when the price reaches +100 pips from the opening price of the order, we transfer the order to Breakeven by setting S,L to +90 pips. After that, if the price moves further in the desired direction and passes by another + 50 pips - S.L. is moved by 50 pips => it should now be at + 140 pips from the opening price of the order. I.e. the S.L. first moves from its base position to + 90 pips from the opening price of the order and then moves if it passes by + 50 pips ( - 500 => + 90 => + 140 => + 190 etc.). And so it goes either until the price reaches T.P. or when the trend reverses and hits the S.L.


I hope I described everything in details, and I really hope for your help, because by adding these missing elements, the Expert Advisor will be ready)) If you have any questions, please ask))) I am pasting a part of the code of the Expert Advisor below:

extern string s1                = "Main options";
extern string Symbol            = "";     
extern int timeframe            = 30;     
extern int MagicNumber          = 122122; 
//+------------------------------------------------------------------+
extern string s2                = "Trading options";
extern int BarsForConfirm       = 40;     
extern double Lot               = 0.01;      // размер лота: 0 - авт.расчет (свободная маржа/9000 => 100/5000=0.02 лота); любое другое число - фиксированный лот
extern int StopLoss             = 50;     // стоплосс (в пунктах)
extern int TakeProfit           = 30;     // тейкпрофит (в пунктах)
//+------------------------------------------------------------------+

bool OrderBuy = true, OrderSell = true, Trade = false;  
int timeprev = 0, Slip = 3.0, Start, cnt=1, a;  
datetime newbar=0;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   if(CheckForOpen()==0) {a=1; Trade = false;}
   else
   if(CheckForOpen()==1) {a=0; Trade = false;}
   else {Trade = true;}
   if (Digits == 3 || Digits == 5) // Пересчет для 5-ти знаков, работает автоматически
     {                                                    
      TakeProfit *= 10;
      StopLoss *=10;
      Slip *=10;
     } 
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  
  {
  
   if(CheckForOpen()==a) Trade = true;
   if(newbar!=Time[0] && Trade==true)  
     {
      if(CheckForOpen()!=Start)        
        {Start=CheckForOpen(); cnt=1;}
      else {cnt+=1;}

      if(cnt==BarsForConfirm) {        
             
                
             
         if(CheckForOpen()==0)         
           {
            if(OrderSend(Symbol(),OP_BUY,Lots(),Ask,Slip,Bid-StopLoss*Point,Ask+TakeProfit*Point,"",MagicNumber,0,Blue))
              {Print("BUY OK");} else {Print(GetLastError());}
           } 
         if(CheckForOpen()==1)         
           {
            if(OrderSend(Symbol(),OP_SELL,Lots(),Bid,Slip,Ask+StopLoss*Point,Bid-TakeProfit*Point,"",MagicNumber,0,Red))
              {Print("SELL OK");} else {Print(GetLastError());}
           }
        }   
      newbar=Time[0];  //открытие ордера на цене открытия свечи
     }
  }
//+------------------------------------------------------------------+
//| Calculate optimal lot size                                       |
//+------------------------------------------------------------------+
double Lots()  // Расчет объема лота
  {
   double Lots;
   if(Lot>0) return(Lot);           
   Lots=AccountFreeMargin()/9000;  // раcчёт лота - свободная маржа/9000 => 100/9000=0.01 лота 
   Lots=MathMin(15,MathMax(0.01,Lots));
   if(Lots<0.1) Lots=NormalizeDouble(Lots,2);
   else 
     {
      if(Lots<1) Lots=NormalizeDouble(Lots,1);
      else       Lots=NormalizeDouble(Lots,0);
     }
   return(Lots);
  }
//+------------------------------------------------------------------+
 
MakarFX #:

Catch

Thank you very much. Sorry I didn't reply straight away - I got distracted.
Tried it out, noticed a little problem...
It only draws if I run it on USDX symbol.
It doesn't show up on EURUSD (it's clear that I'm changing Symbol_2).
See pictures, it may be easier to understand.
Any idea why this is so, how to fix it ?
Files:
EURUSD.JPG  260 kb
USDX.JPG  318 kb
 

Hello.

Sorry for the stupid question... The order is now properly placed, then error 129 - wrong price. It's getting to be a pain in the ass... Help me out... ((


int f = OrderSend(para_2,OP_BUY,0.1,Ask_para_2,3,0,0,"",0,Blue); if(f < 0){Alert("Error setting Buy Stop order: ", GetLastError());}