Reply

Problem setting value of variable

4 replies

chris.marshall

Subscriber, bbp_participant, community, 4 replies.

Visit profile

7 years ago #116240

I am trying to write my first indicator that will send a notification when AO crosses zero

 

If it crosses down must have reached a max positive value first.

If it crosses up must have reached a max negative value first.

 

I have a variable that I am trying to set to 1 when it reaches the max value and then test for value = 1 when crosses zero and if rule is met reset the value to zero. I am starting with this variable set to zero but it doesn’t seem to be getting set to 1 on a max cross as the max crosses indicate but the zero’s don’t and if I get 2 maxes in a row without a zero cross they both indicate. If the variable was getting set to 1 the second high shouldn’t indicate as the variable would be set to 1 from the first high and should be zero for a high to indicate.

 

Any help would be appreciated.

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

7 years ago #141214

Hello,

 

it is always useful to use logging if you are not sure whether something is or is not happening with your EA. Use Log to Journal to dump a variable to see if crossover works. I will check your project ..

0

chris.marshall

Subscriber, bbp_participant, community, 4 replies.

Visit profile

7 years ago #141289

Added journal output to each rule as suggested and also tried running as EA rather than indicator. Seems as EA it will do what I want but running as an indicator it doesn’t.

 

My understanding was an indicator could do everything an EA could except make and manage trades? I have an EA on the chart already for trade entry so wanted this to be an indicator rather than an EA.

 

Anyone have a suggestion on how I can make this work as an indicator or will I need to have 2 instances of each chart with this loaded as an EA on one and my entry and management EA loaded on the other?

 

Any suggestions would be appreciated.

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

7 years ago #141312

Hi Chris, I will also check those files attached and let you know

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

7 years ago #141480

Hello,

 

the signal indicator code works slightly different compared to EA code hence some functions can behave differently compared to it. Can you add your trading rules and have this working as an EA?

0

Viewing 4 replies - 1 through 4 (of 4 total)