Digitals113: I am trying to hold the value 'InsideResistance' or 'InsideSupport' for 10 candles unless the opposite becomes true.
That is babel. Until you can state it in concrete terms, it can not be coded and no one can help you.
William Roeder:
That is babel. Until you can state it in concrete terms, it can not be coded and no one can help you.
OK I will give more explanation.. Once the bid goes above a price 'InsideResistance' becomes true. I want to hold the value as true for 10 candles even if the bid goes below the price.
Digitals113: I want to hold the value as true for 10 candles even if the bid goes below the price.
- On condition, remember the non-series bar index and when the as-series equivalent becomes 11, reset.
#define SERIES(I) (Bars - 1 - I) // As-series to non-series or back.
- Or remember the time and use iBarShift to get as-series index.
William Roeder:
- On condition, remember the non-series bar index and when the as-series equivalent becomes 11, reset.
- Or remember the time and use iBarShift to get as-series index.
I know how to code the second option, could you explain more about this so I can understand better? Thank you.
Digitals113: could you explain more about this so I can understand better?
What part is unclear?
William Roeder:
What part is unclear?
int I = 10 (Bars - 1 - I)
Is this correct?
void TouchedSR() { double HiCandle = iHigh(NULL, TradingTimeframe, 0); //high of current candle double LoCandle = iLow(NULL, TradingTimeframe, 0); //low of current candle //Test for being inside a zone. if(LoCandle <= HI_Res && HiCandle >= LO_Res && Bid>WeekPivot && Bid<=R138 && Bid>=DRangeHigh-DRange75) //Signal code { InsideResistance = true; //signal true ResSignal=iTime(NULL,TradingTimeframe,0); //Time of candle signal happened } if(!CloseEnough(ResSignal,0)) //Check if ResSignal is greater than 0 { RST=iBarShift(NULL,TradingTimeframe,ResSignal,true); //Shift of bar signal if(RST>10) //if shift is more than 10 candles { InsideResistance=false; //signal false ResSignal=0; //Reset signal time } } }
This is the code that seems to do the job, is there anything I can improve on?

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
I am trying to hold the value 'InsideResistance' or 'InsideSupport' for 10 candles unless the opposite becomes true. I am somewhat new to mql4 and I am wondering if I am accomplishing this with the code above.
Thanks for your help.