Hi Coders, could you please advise me on these coding issues.
I'm testing with 3 scenario of crypto prices as below and I'm using the M30 current Bar0's M1 shift to get the breakout bars that Close price below the destinated prices (PxLevelA/B/C), i.e my signal will only fall into the M1 bars of M30 current Bar0.
Now, I CANNOT get the M1 1st bar's shift if the signal conditions are met, i.e cCs0 < PxLevelA/B.
If the M1 bar's shift is NOT the 1st shift, I can get the bar's shift if the conditions are met.
Kindly look at my picture, I'm expecting the output result should be " 8 || 8 || 8 || 5 " but do not know why the codes cannot get the M1 1st bar's shift.
Could you please advise where my codes go wrong and what would be the coding solution ? Thanks
My mission is to get the M1 bar's breakout shift. If the breakout happens on the M1 1st bar's shift, I need the shift number, but if the breakout falls on other M1 bar, I need to get the shift too.
Why I need to ensure that the codes can get the M1 1st bar's shift info ? This is because I need the "shift" for other calculation purposes. If the "shift" is NOT cCs0<PxLevelA/B/C, there is no issue at all, but if the "1st bar's shift" is cCs0<PxLevelA/B/C (onditions are met) and the output = 0, means I cannot proceed with other calculations.
** If you want to test the codes above by yourself, you may sign up a demo account at ACY Securities, AdmiralMarkets, Axiory, Swissquote, CMTrading, Easy Markets, Forex.com, FxOpen, FxPrimus, Hugo's Way, ICMarkets, IG, InstaForex, RoboForex, TenkoFx, EagleFx ... from my understanding, these brokers have cryptocurrency 24/7.
I'm testing with 3 scenario of crypto prices as below and I'm using the M30 current Bar0's M1 shift to get the breakout bars that Close price below the destinated prices (PxLevelA/B/C), i.e my signal will only fall into the M1 bars of M30 current Bar0.
Inserted Code
double PxLevelA=46450;
double PxLevelB=46390;
double PxLevelC=46375;
int b0M30Sf=iBarShift(symbol,PERIOD_M1,iTime(symbol,PERIOD_M30,0),true);
int BreakOutM1SfA=0; for(int i=b0M30Sf; i>=1; i--) {double cCs0=iClose(symbol,1,i);
if(cCs0<PxLevelA) break; BreakOutM1SfA=i-1;}
int BreakOutM1SfB=0; for(int i=b0M30Sf; i>=1; i--) {double cCs0=iClose(symbol,1,i);
if(cCs0<PxLevelB) break; BreakOutM1SfB=i-1;}
int BreakOutM1SfC=0; for(int i=b0M30Sf; i>=1; i--) {double cCs0=iClose(symbol,1,i);
if(cCs0<PxLevelC) break; BreakOutM1SfC=i-1;}
//{Alert(symbol+" M1 B/Out Shift BarStartShift || A || B || C : "+
//IntegerToString(b0M30Sf)+" || "+IntegerToString(BreakOutM1SfA)+" || "+
//IntegerToString(BreakOutM1SfB)+" || "+IntegerToString(BreakOutM1SfC));} Now, I CANNOT get the M1 1st bar's shift if the signal conditions are met, i.e cCs0 < PxLevelA/B.
If the M1 bar's shift is NOT the 1st shift, I can get the bar's shift if the conditions are met.
Kindly look at my picture, I'm expecting the output result should be " 8 || 8 || 8 || 5 " but do not know why the codes cannot get the M1 1st bar's shift.
Could you please advise where my codes go wrong and what would be the coding solution ? Thanks
My mission is to get the M1 bar's breakout shift. If the breakout happens on the M1 1st bar's shift, I need the shift number, but if the breakout falls on other M1 bar, I need to get the shift too.
Why I need to ensure that the codes can get the M1 1st bar's shift info ? This is because I need the "shift" for other calculation purposes. If the "shift" is NOT cCs0<PxLevelA/B/C, there is no issue at all, but if the "1st bar's shift" is cCs0<PxLevelA/B/C (onditions are met) and the output = 0, means I cannot proceed with other calculations.
** If you want to test the codes above by yourself, you may sign up a demo account at ACY Securities, AdmiralMarkets, Axiory, Swissquote, CMTrading, Easy Markets, Forex.com, FxOpen, FxPrimus, Hugo's Way, ICMarkets, IG, InstaForex, RoboForex, TenkoFx, EagleFx ... from my understanding, these brokers have cryptocurrency 24/7.