Asked and answered TWICE ALREADY
No, this is other indicator much different. Not related.
EXACTLY THE SAME PROBLEM
Buf_0[i] = Math(MainPair,SecondPair,TimeFrame,i); : double Math(string MainPair, string SecondPair, int TF, int index){ : for(int i=1+index; i<=Bars2Compare+index; i++) { VectorMain[i] = iClose(MainPair,TF,i); VectorSecond[i] = iClose(SecondPair,TF,i);
in start() i is the current pair/current TF
in Math() index is the current pair/current TF. Therefor Math()'s i is ALSO current pair/current TF
iClose( other than current pair/TF, i) is BOGUS
Thanks for your patience. Is this the correct way? exactly the same problem, exactly the same solution...
while(i>=0) { datetime when0 = Time[i]; int iMain0 = iBarShift(MainPair,TimeFrame,when0); Buf_0[i] = Math(MainPair,SecondPair,TimeFrame,iMain0); i--; } : double Math(string MainPair, string SecondPair, int TF, int index){ : for(int i=1+index; i<=Bars2Compare+index; i++) { datetime when1 = Time[i]; int iMain1 = iBarShift(MainPair,TimeFrame,when1); int iScnd1 = iBarShift(SecondPair,TimeFrame,when1); VectorMain[i] = iClose(MainPair,TF,iMain1); VectorSecond[i] = iClose(SecondPair,TF,iScnd1); }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Dear Forum,
I want to create an indicator which shows the value for each bar of a mathematical formula. There is something wrong as it's not being painted right. What it could be?
Any help would be greatly appreciated!
Regards.