Questions from Beginners MQL5 MT5 MetaTrader 5 - page 962

 
Artyom Trishkin:

The compiler doesn't swear, but warns that you are trying to put double into int.


A great picture on the subject - it's funny, thank you.

 
Alexey Viktorov:

Try also DRAW_COLOR_CANDLES

Thank you, I will give it a try.
 
Alexey Viktorov:

Try also DRAW_COLOR_CANDLES

DRAW_COLOR_CANDLES does not change the width, although it is present in the example documentation (#property indicator_width1 1). Therefore overlaying one candle on top of another will not work.

 
Nauris Zukas:

DRAW_COLOR_CANDLES does not change the width, although it is present in the example documentation (#property indicator_width1 1). Therefore, overlaying one candle on top of another will not work.

You can calculate the width of the bars in pixels, and use this value to determine the thickness of the histograms. All in all, if you want...

 
Alexey Viktorov:

You can calculate the width of the bars in pixels, and use this value to determine the thickness of the histograms. All in all, if you want to...

"...the width of the bars in pixels..." I don't really understand how to do it.

 
Nauris Zukas:

"...calculate the width of bars in pixels..." I don't really understand how to do it.

Anyway, if you want to, you have to check what you get. I haven't tested it, for want of a reason...

Scale

Mode of specifying scale in pixels per bar


Chart width in pixels /Chart width in bars This may not work when the indent from the right edge of the chart is set.

 
Alexey Viktorov:

Anyway, if you want to, you have to check what you get. I haven't tested it, for want of a reason...

Scale

Scale mode in pips per bar


Chart width in pixels /Chart width in bars This may not work when set to indent the right edge of the chart.

Thank you.

 
Help me out here, people of goodwill...
I've encountered such a mess in the tester.
When trying to put a filter to enter the market by spread level. Tester ignores it (spread).
But it ignores it only from the last 6 months. 5 (last) months tests normally, filters.
I read somewhere that the tester accounts spread in its own way and makes it impossible to filter it,
But what's confusing is that for the last 5 months it still takes it into account and handles it in a friendly way...
Screenshot attached.
The question is this.
Is this a feature of the tester? Or it has some settings that I do not know about?
Or maybe this condition needs to be set as a software?

I wrote the filter for testing this way...

void OnTick()
  { 
  double ask=SymbolInfoDouble(Symbol(),SYMBOL_ASK); 
  double bid=SymbolInfoDouble(Symbol(),SYMBOL_BID);
  double spread=ask-bid; 
  
  if (PositionsTotal()>=1) 
  return;
  {
  int spread_points=(int)MathRound(spread/SymbolInfoDouble(Symbol(),SYMBOL_POINT)); 
  if (spread_points<=5)
  {
  trade.Buy(0.1,_Symbol,ask,bid-300*_Point,bid+300*_Point);
  }
  }
  }

Well... that's how I wrote it.)

Files:
 
vladzeit:
Help me, good people...
I've encountered such a mess in the tester.
When trying to put a filter to enter the market by spread level. Tester ignores it (spread).
But it ignores it only from the last 6 months. For 5 months the tester tests normally, it filters.
I read somewhere that the tester has its own way of calculating the spread and makes it impossible to filter it,
But what's confusing is that for 5 months it still takes it into account and handles it in a friendly way...
Screenshot attached.
The question is this.
Is this a feature of the tester? Or it has some settings that I do not know about?
Or maybe this condition needs to be set as a software?

I wrote the filter for testing this way...

Well... that's how I wrote it)

You should test it in"Every tick based on real ticks" mode:

//+------------------------------------------------------------------+
//| "Tick" event handler function                                    |
//+------------------------------------------------------------------+
void OnTick()
  {
   double ask  = SymbolInfoDouble(Symbol(),SYMBOL_ASK);
   double bid  = SymbolInfoDouble(Symbol(),SYMBOL_BID);
   long spread = SymbolInfoInteger(Symbol(),SYMBOL_SPREAD);

   if(ask==0.0 || bid==0.0 || spread=0)
      return;

   if(PositionsTotal()>0)
      return;

   if(spread_points<=InpSpread)
     {
      trade.Buy(0.1,Symbol(),ask,ask-300*Point(),ask+300*Point());
     }
  }

InpSpread - input long parameter.

 
Vladimir Karputov:

Test in"Every tick based on real ticks" mode:

InpSpread - input long parameter.

Thank you Vladimir, I have set the input long.

input long  InpSpread =5;
spread=0 //поправил, на == это ведь сравнение?
if(spread_points<=InpSpread) // поправил на spread

Everything works, but it still filters the spread only for 5 months. I respect"Every tick based on real ticks".

Maybe it is because ofMetaQuotes, I will try other ones now.

Reason: