Plot function: dynamic color but not dynamic style?

#1
Dear all,
why it is possible write this:

dynamic_color = IIf( MACD() > 0, colorGreen, colorRed );
Plot( MACD(), "My MACD", dynamic_color );

but it is not possible to write this:

dynamic_style = IIf( MACD() > 0, StyleThick, styleDots );
Plot( MACD(), "My MACD", colorgreen, dynamic_Style );

here below the error message:
Error 5. Argument #1 has incorrect type (the function expects different argument type here)
This error occurs when argument passed during function call has invalid type. For example when you pass string instead of array


How can I solve this problem?




thank you

cippo
 
Last edited:
#2
Dear all,
why it is possible write this:

dynamic_color = IIf( MACD() > 0, colorGreen, colorRed );
Plot( MACD(), "My MACD", dynamic_color );

but it is not possible to write this:

dynamic_style = IIf( MACD() > 0, StyleThick, styleDots );
Plot( MACD(), "My MACD", colorgreen, dynamic_Style );

here below the error message:
Error 5. Argument #1 has incorrect type (the function expects different argument type here)
This error occurs when argument passed during function call has invalid type. For example when you pass string instead of array

How can I solve this problem?
any suggestion to solve or bypass this problem?
tks
cippo
 

mastermind007

Well-Known Member
#3
any suggestion to solve or bypass this problem?
tks
cippo
dynamic_color = IIf( MACD() >= 0, colorGreen, colorRed );
m = MACD();
Plot( IIf(m > 0, m, Null), "My MACD", dynamic_color, styleThick);
Plot( IIf(m >= 0, Null, m), "", dynamic_color, styleDots);
 

Similar threads