A few questions about an indicator

 

Hello

I have three questions about an indicator I hope you can help with. Indicator is attached below.


1. I have add a setting to let the user choose if he wants the indicator to draw arrows or not. I add this line: input bool DrawArrowsON = true; //Draw arrows

Then I need to add: if(DrawArrowsOn) { [code for drawing arrows] }

Where should I add this?


2. If user sets alert to true then there is 2 messages in the alert box, it should be only 1. How can I change this? (I have tried to change the NumberofAlerts variable, doesn't make any difference).


3. When I compile the indicator, I get a warning message below Description box: "expression not boolean", and it points to this line: if(bar==1&!flagval2)

What's wrong?


Thank you.

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
When creating a custom indicator, you can specify one of 18 types of graphical plotting (as displayed in the main chart window or a chart subwindow), whose values are specified in the ENUM_DRAW_TYPE enumeration. Depending on the drawing style, you may need one to four value buffers (marked as INDICATOR_DATA). If a style admits dynamic...
Files:
 
marketcycle17:

Hello

I have three questions about an indicator I hope you can help with. Indicator is attached below.


1. I have add a setting to let the user choose if he wants the indicator to draw arrows or not. I add this line: input bool DrawArrowsON = true; //Draw arrows

Then I need to add: if(DrawArrowsOn) { [code for drawing arrows] }

Where should I add this?


2. If user sets alert to true then there is 2 messages in the alert box, it should be only 1. How can I change this? (I have tried to change the NumberofAlerts variable, doesn't make any difference).


3. When I compile the indicator, I get a warning message below Description box: "expression not boolean", and it points to this line: if(bar==1&!flagval2)

What's wrong?


Thank you.

add 1) within the twi ifs, at line 210 and 220 - I guess

add 2) I wont use counter for both buy and sell! I would use newBar and BuyBuffer[1] != BuyBuffer[2] for buy

add 3) I guess (!) that this: if(bar==1&!flagval2) should be if(bar==1 && !flagval2) ?

 
Carl Schreiber:

add 1) within the twi ifs, at line 210 and 220 - I guess

add 2) I wont use counter for both buy and sell! I would use newBar and BuyBuffer[1] != BuyBuffer[2] for buy

add 3) I guess (!) that this: if(bar==1&!flagval2) should be if(bar==1 && !flagval2) ?


Thank you Carl. Will try this. However I don't understand the second answer. Could you clarify further? I don't know much about programming in MQL :) The indicator is not written by me, I have only made small adjustments.