[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 399

 
kolyango:

I'll definitely look at your links...

Criterion.mqh.

Writes plugin content and that's it, nothing opens or downloads!


And so tried, from the previous page: "Right mouse click on the trailer, then in the menu "save as"?

I've tried it, it's downloading properly.


 
Roman.:


Have you tried it this way, from the previous page: "Right-click on the trailer, then in the menu "save as link"?

I've tried it, it works fine for me.



Downloaded. Why .mqh and not .mq4?
 

Can you tell me how to change the background colour of the additional indicator window, or can you specify the background colour of the additional window in the profile?

//+------------------------------------------------------------------+
//|                                                  Custom MACD.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property  copyright "Copyright © 2004, MetaQuotes Software Corp."
#property  link      "http://www.metaquotes.net/"
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 2
#property  indicator_color1  Silver
#property  indicator_color2  Red
#property  indicator_width1  2
//---- indicator parameters
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;
//---- indicator buffers
double     MacdBuffer[];
double     SignalBuffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexDrawBegin(1,SignalSMA);
   IndicatorDigits(Digits+1);
//---- indicator buffers mapping
   SetIndexBuffer(0,MacdBuffer);
   SetIndexBuffer(1,SignalBuffer);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("MACD("+FastEMA+","+SlowEMA+","+SignalSMA+")");
   SetIndexLabel(0,"MACD");
   SetIndexLabel(1,"Signal");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer
   for(int i=0; i<limit; i++)
      MacdBuffer[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line counted in the 2-nd buffer
   for(i=0; i<limit; i++)
      SignalBuffer[i]=iMAOnArray(MacdBuffer,Bars,SignalSMA,0,MODE_SMA,i);
//---- done
   return(0);
  }
//+------------------------------------------------------------------+
 
kolyango:

Downloaded. Why .mqh and not .mq4?


Because it is a plug-in file, for example,

#include <stdlib.mqh>
#include <stderror.mqh>
//#include <dynamic_channel.mqh>             // динамический канал
#include <TrailingByFractals.mqh>          // trailing
read the tutorial - this is the #include directive.
 

Good afternoon!

Can you please tell me how to draw a vertical bar (histogram) from 0 to 4 (for example) in the subwindow (graphical object)?

The point is that the indicator subwindow contains a 0 line on both sides of which the breakdown signal is displayed (sell-down, buy-up).

I know how to do it with a buffer, but there are no buffers available, ran out.

Thanks.

 
LOA:

Good afternoon!

Please tell me how to draw a vertical bar (histogram) from 0 to 4 (for example) in a sub-window (graphical object)


ObjectCreate
 
sergeev:
ObjectCreate

It is clear that with the ObjectCreate function
but the difficulty is how to assign values to graphic objects depending on the direction of the signal 4 or -4 relative to the zero line.
 
artmedia70:

It's as simple as that. Let's use the flags as a semaphore. There will be three blocks of code, each of which will be executed only if the previous one is already executed.

Initially all flags ==false.

As soon as the first one has been executed, we put first flag=true; Now the second code block is executed. As soon as its condition is fulfilled, set second flag=true;
Now the third code block is executed. As soon as its condition is met, set the third flag=true; And so on.



Give me a link to read more about flags with descriptions of their actions and examples of how to use them?
 
LOA:

This is understandable with the ObjectCreate function
but the difficulty is how to assign values to graphic objects depending on signal direction 4 or -4 relative to the zero line.

Buffers run out ))

#property indicator_separate_window
#property indicator_minimum -8
#property indicator_maximum 8
void start()  {
   ObjectsDeleteAll(1);
   for(int i=0;i<WindowBarsPerChart();i++){
         if(Open[i]>iMA(0,0,5,1,1,4,i))
            double xz=4;
         else xz=-4;
         ObjectCreate(i+" f",OBJ_TREND,1,iTime(0,0,i),0,iTime(0,0,i),xz);
         ObjectSet(i+" f", OBJPROP_RAY, 0);
   }
   WindowRedraw();
}
 
costy_:

We're out of buffers ))

Why are you teaching incorrect programming?

ObjectsDeleteAll(1);

How do you know that this indicator window descriptor == 1 ?

Reason: