Download MetaTrader 5

Indicators: Camarilla Level Pivots

To add comments, please log in or register
MetaQuotes Software Corp.
Moderator
185986
MetaQuotes Software Corp.  

Camarilla Level Pivots:

Camarilla Level Pivots.

Author: oneoleguy

AutoAbacus
25
AutoAbacus  

Thanks for posting this.

Re your concerns:

1. The old MT4 (before Build 600) only supported 8 indicators whereas you have used 9. Perhaps the properties listing of only 8 colors is a hangover from the old MT4? (If so this is something for MetaQuotes to fix.)

2. The lines not extending to the last couple of bars is because the indicator as you have it runs for every tick and redraws for the last couple of bars each time. If these did not happen to coincide with a start of day then your if test inside the loop does not ever pass and so yesterday_high, yesterday_low, and yesterday_close remain uninitialized (defaulting to zero), causing the lines to dive to the bottom of the chart.

The fix is simple: make yesterday_high, yesterday_low, and yesterday_close static by adding the keyword static to their declaration in start(), or make then global, so that either way they retain their values between invocations of start().

(If you had compiled in strict mode under Build 600 or later by adding

#property strict

you would have been warned about this mistake by the warnings "possible use of uninitialized variable 'yesterday_high'" etc.)






AutoAbacus
25
AutoAbacus  

Thanks for posting this.

Re your concerns:

1. The old MT4 (before Build 600) only supported 8 indicators whereas you have used 9. Perhaps the properties listing of only 8 colors is a hangover from the old MT4? (If so this is something for MetaQuotes to fix.)

2. The lines not extending to the last couple of bars is because the indicator as you have it runs for every tick and redraws for the last couple of bars each time. If these did not happen to coincide with a start of day then your if test inside the loop does not ever pass and so yesterday_high, yesterday_low, and yesterday_close remain uninitialized (defaulting to zero), causing the lines to dive to the bottom of the chart.

The fix is simple: make yesterday_high, yesterday_low, and yesterday_close static by adding the keyword static to their declaration in start(), or make then global, so that either way they retain their values between invocations of start().

(If you had compiled in strict mode under Build 600 or later by adding

#property strict

you would have been warned about this mistake by the warnings "possible use of uninitialized variable 'yesterday_high'" etc.)






To add comments, please log in or register