Monitoring 34 pairs.
Values stored in array
Trying to count the number of up & down moves from the open within a particular bar.
Each time chart symbol is changed the returned numbers change and cannot work out why.
The routine below is called every tick or on symbol change.
Can you spot my error please?
TIA
M.
Values stored in array
Trying to count the number of up & down moves from the open within a particular bar.
Each time chart symbol is changed the returned numbers change and cannot work out why.
The routine below is called every tick or on symbol change.
Can you spot my error please?
Inserted Code
void CheckMulti() { datetime mBtime = iTime(NULL, mTF, 0); int mCnt = 0, mCntd = 0, mPipF = 1, i = 0; bool mWait = true, mWaitd = true; double mB1Op = 0, mMove = 0; ArrayInitialize(mUD, 0); for(i = 0; i < mPairs; i++) { string mName = UniqueID+":symbol:" + IntegerToString(i); mBtime = iTime(aSymbols[i], mTF, 0); mCnt = 0; mCntd = 0; mPipF = 1; mWait = true; mWaitd = true; mB1Op = iOpen(aSymbols[i], mTF, 0); if(MarketInfo(aSymbols[i], MODE_DIGITS) == 3 || MarketInfo(aSymbols[i], MODE_DIGITS) == 5) mPipF = 10; mMove = mCndlMove * Point * mPipF; // How many lower TF candles since higher TF open int mCndls = (int)(iTime(NULL, mCountTime, 0) - iTime(NULL, mTF, 0)) / mCountTime / 60; // Count moves up for(int n = 0; n < mCndls; n++) { if(iLow(aSymbols[i], mCountTime, iBarShift(aSymbols[i], mCountTime, mBtime) -n) <= mB1Op) mWait = false; if(iHigh(aSymbols[i], mCountTime, iBarShift(aSymbols[i], mCountTime, mBtime) -n) >= mB1Op + mMove && !mWait) { mCnt ++; mWait = true; } } mUD[i][0] = mCnt; // Count moves down for(int d = 0; d < mCndls; d++) { if(iHigh(aSymbols[i], mCountTime, iBarShift(aSymbols[i], mCountTime, mBtime) - d) >= mB1Op) mWaitd = false; if(iLow(aSymbols[i], mCountTime, iBarShift(aSymbols[i], mCountTime, mBtime) - d) <= mB1Op - mMove && !mWaitd) { mCntd ++; mWaitd = true; } } mUD[i][1] = mCntd; } // for i return; }
TIA
M.
If you think I'm mad, I must be mad