Hi Fellas
seems as if i have written some bad code... I would like to measure the slope of a linear regression curve in dependence of the relative shift to the current bar, the function actually works but only for i=0, for every other value of i the function returns 2147483647.00 (empty value). What have i done wrong? i would be pleased someone to help me...
<CODE REMOVED>
Please edit your post . . .
Hi Fellas
seems as if i have written some bad code... I would like to measure the slope of a linear regression curve in dependence of the relative shift to the current bar, the function actually works but only for i=0, for every other value of i the function returns 2147483647.00 (empty value). What have i done wrong? i would be pleased someone to help me...
- Because you are never populating any other element but the zero.
Updating slope[0] only
int start() {int i; slope[i]=slope(i, SymbolY, SymbolX);
In an indicator int start(){ int counted = IndicatorCounted(); if(counted < MA_Period) counted = MA_Period; // Don't look past end for(int i = Bars-1-counted; i>=0; i--) slope[i]=slope(i, SymbolY, SymbolX);
In a EA datetime lastComputed; int init(){ lastComputed = 0; } int start(){ int i = iBarShift(NULL,0, lastComputed); lastComputed = Time[0]; if (i > Bars - MA_Period) i = Bars - MA_Period; // Don't look past end for(; i>=0; i--) slope[i]=slope(i, SymbolY, SymbolX);
- It is also bad style to name your variables the same as your functions.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi Fellas
seems as if i have written some bad code... I would like to measure the slope of a linear regression curve in dependence of the relative shift to the current bar, the function actually works but only for i=0, for every other value of i the function returns 2147483647.00 (empty value). What have i done wrong? i would be pleased someone to help me...