I initialize the variable to the previous bars dataseries value.
Then check for each condition to see if the value should be changed.
Then save the value to the dataseries. ( so expect to save a new value or previously set value )
When a condition is met it is correctly saving the value.
But when neither is met it is saving zero instead of the value from prev bar.
( once the value is 3, it should stay 3 until changed to 1 )
small code snippet:
gHiLo = (int)gHitHiLo[1]; // init to prev bar value
if( cciVal >= minAbsVal )
gHiLo = 3 ; // signal cci has crossed 100 line
if( cciVal <= (-1 * minAbsVal) )
gHiLo = 1; // signal cci has crossed -100 line
gHitHiLo.Set( gHiLo ); // store value to dataseries
Also, I have had problems when performing a plot and the value is a negative number ? It does not do the plot and get a log "overflow error"
Example Plot0.Set( -2 );
Thanks
Comment