MQL5 preprocessor - is this possible?

 

Hello World,

I want to do some kind of

#define dMACDMain 0
.

.

.

#property indicator_label__dMACDMain+1__ "MACD Main (0)"

.

.

.

   SetIndexBuffer(dMACDMain,   MACDMain,      INDICATOR_DATA);

to get rid of silly errors, where these numbers get confused...

So preprocessor should use dMACDMain, add 1 and replace to #property indicator_label1 "MACD Main (0)". If possible, what syntax should I use?

Many thanks

 
Al Bundy:

Hello World,

I want to do some kind of

#define dMACDMain 0
.

.

.

#property indicator_label__dMACDMain+1__ "MACD Main (0)"

.

.

.

   SetIndexBuffer(dMACDMain,   MACDMain,      INDICATOR_DATA);

to get rid of silly errors, where these numbers get confused...

So preprocessor should use dMACDMain, add 1 and replace to #property indicator_label1 "MACD Main (0)". If possible, what syntax should I use?

Many thanks

No, it's not possible.
 
Al Bundy:

Hello World,

I want to do some kind of

#define dMACDMain 0
.

.

.

#property indicator_label__dMACDMain+1__ "MACD Main (0)"

.

.

.

   SetIndexBuffer(dMACDMain,   MACDMain,      INDICATOR_DATA);

to get rid of silly errors, where these numbers get confused...

So preprocessor should use dMACDMain, add 1 and replace to #property indicator_label1 "MACD Main (0)". If possible, what syntax should I use?

Many thanks

An alternative is to use PlotSet... functions instead of #property.

In your example, for the label you can call:

PlotIndexSetString(0, PLOT_LABEL, "MACD Main (0)");
Documentation on MQL5: Constants, Enumerations and Structures / Indicator Constants / Drawing Styles
Documentation on MQL5: Constants, Enumerations and Structures / Indicator Constants / Drawing Styles
  • www.mql5.com
Drawing Styles - Indicator Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5