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

 
MakarFX #:

Yes, you made a mess)

Now in each folder, one by one, rename the Experts folder to _Experts and the Indicators folder to _Indicators.

Renamed in one folder - start the terminal, if it did not help - rename it back and go to the next folder.

P.S. The first time the terminal will start a little longer than usual.

Makar!

The event happened today. Therefore, I did not touch folders with old dates.

And making changes to the fresh folders didn't change anything.

So I dragged profiles, indicators and Expert Advisors to another terminal. I finally finished the mess.

Now everything is working. I have it on a different terminal, though. But the important thing is the result - you can work.

I will delete that terminal later.

I think your suggestion to find the indicators and profiles via the editor is perfect!

Especially for such "dummies" in programming, like me.

Thank you very much for your help and responsiveness!

Good luck!

Regards!

 

Hi all. Just beginning to understand everything on this to say at once that I am greener than green. I don't know how much time I have, but I'll get some experience. Can you tell me who has faced with this situation? I need a script or code which keeps watch in the next 10 points up and down and no open Buy and Sell.

1.....For example a tick came - the code looks if in the next 10 points down and (or) up the order is not, then set a sell order. if there is nothing. Also with a buy order

Here is an examplescheme in theForex EA Generator



Files:
hktrabmcw4.jpg  222 kb
 
valentin104 a script or code which keeps watch in the next 10 points up and down and no open Buy and Sell.

1.....For example a tick came - the code looks if in the next 10 points down and (or) up the order is not, then set a sell order. if yes, then nothing. Also with a buy order

Here is an examplescheme in theForex EA Generator



This scheme is idiotic.

 
Artyom Trishkin #:

It's an idiotic scheme.

No, it looks like that without if and else). But that's not what I meant.

SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_SIZE)

The script gives tick_s =1.0 tick_vflue =80.32786885245902, but in the owl tick_value =80.37529660186777 tick_size =1e-05

The score breaks down.




 
Artyom Trishkin #:

It's an idiotic scheme.

You missed the point.

valentin104 #:

Hey, everybody. I'm just getting to grips with it all, so I'll just say this I'm greener than green.

 
Galim_V #:

No, it looks like that without if and else). But that's not what I meant.

The script gives tick_s =1.0 tick_vflue =80.32786885245902 and in the owl tick_value =80.37529660186777 tick_size =1e-05

The tick_value is broken.




tick_size =1e-05

Normalize DoubleToString( tick_size , 2)

 
MakarFX #:

tick_size =1e-05

Normalize DoubleToString( tick_size , 2)

Zeros all alone. Not even a hundredth.

//+------------------------------------------------------------------+
//|                                                     MAX+risk.mq4 |
//|                        Copyright 2019, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property script_show_inputs
enum Mani
  {
   free_margin,
   balans
  };
input Mani risk_mani;
input double Lot=0.0;
input int max_risk =0; //В% от свободных средсв или...
input int stoploss=300;
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   double Lots=0;
   int    Max_Risk=0;

   printf("ACCOUNT_MARGIN_FREE =  %G",AccountInfoDouble(ACCOUNT_MARGIN_FREE)); //Размер свободных средств на счете  в валюте
   printf("ACCOUNT_BALANCE =  %G",AccountInfoDouble(ACCOUNT_BALANCE)); //Баланс счета в валюте депозита
   printf("ACCOUNT_MARGIN_LEVEL =  %G",AccountInfoDouble(ACCOUNT_MARGIN_LEVEL));    // Уровень залоговых средств в %

   double freemani=AccountInfoDouble(ACCOUNT_MARGIN_FREE);
   double balance=AccountInfoDouble(ACCOUNT_BALANCE);
   double tick_s =  SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_SIZE)/_Point;  //Минимальное изменение цены
   double tick_value= SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_VALUE);//Размер минимального изменения цены инструмента в валюте депозита
   if(risk_mani==balans)
     {
      if(max_risk>0&&stoploss>0)
        {
         double tmp= balance*max_risk/100/(stoploss*_Point*SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_VALUE)/SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_SIZE));
         Lots=NormalizeDouble(tmp,2);
         printf(" Чтобы max_risk был не более %f%s%d%s%f",max_risk," в % от ACCOUNT_BALANCE при stoploss =",stoploss,",неоходим Lots =",Lots);
        }
      if(Lot>0)
        {
         Max_Risk= (int)MathRound(Lot*(stoploss*_Point*SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_VALUE)/SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_SIZE))/balance*100);
         printf(" Max_Risk при Lot=%f%s%d,%s%d%s",Lot," и stoploss =",stoploss," будет =",Max_Risk,"%");
        }
     }
   if(risk_mani==free_margin)
     {
      if(max_risk>0&&stoploss>0)
        {
         double tmp= freemani*max_risk/100/(stoploss*_Point*SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_VALUE)/SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_SIZE));
         Lots=NormalizeDouble(tmp,2);
         printf(" Чтобы max_risk был не более %f%s%d%s%f",max_risk," в % от ACCOUNT_MARGIN_FREE при stoploss =",stoploss,",неоходим Lots =",Lots);
        }
      if(Lot>0)
        {
         Max_Risk= (int)MathRound(Lot*(stoploss*_Point*SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_VALUE)/SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_SIZE))/freemani*100);
         printf(" Max_Risk при Lot=%f%s%d,%s%d%s",Lot," и stoploss =",stoploss," будет =",Max_Risk,"%");
        }
     }
   Print("Lots =",Lots," Max_Risk =",Max_Risk," tick_s =",tick_s," tick_vflue =",tick_value);
  }
//+------------------------------------------------------------------+

It works here. In the board, variables instead of functions. But already from the beginning the function generates nonsense in OnTick().

 
Galim_V #:

All zeros. Couldn't even find a hundredth.

It works here. In owl, variables instead of functions. But the function already generates nonsense in OnTick().

Found it. Sorry. Value of tick_size =1e-05 is 0.00001 and is correct.

 
valentin104 #:

I'll tell you right off the bat, I'm greener than green. I don't know how long I'll last.


With this approach to learning programming, you're better off hiring a programmer and not having to worry about it.

 

We have a standard ZigZag indicator, but its style of line drawing is DRAW_SECTION, i.e.the most part of values in indicator buffer is equal to EMPTY_VALUE and only sometimes there appear different values (break points) that serve as the basis for line drawing. I think that everyone has seen this indicator and/or its code at least once in their life.

The task is to get the value, that corresponds to the last break point, i.e. the latest value of the indicator buffer, that isn't equal to EMPTY_VALUE.

Attention: Is it the right approach to loop through the indicator buffer values, starting from a zero shift downwards, calling the iCustom function at every iteration, until the obtained value is different from EMPTY_VALUE?

Or is there some easier way to get this value?