Hi Guys,
Please suggest me with a logic to get a alert on the immediate next candle stick, if the arrow appears and remains constant on previous candle stick.
Let me explain the image, But arrow appears at 22:00hrs and the below code generates a buy alert on the immediate next candle stick i.e 23:00 (which is perfect) works as expected.
Problem Example below : the Arrow appears at 09:00hrs and disappears immediately, then it reappears at 10:00hrs, When this happens variable 'i' increments its value to '2' which will give a false alert, how can i make variable 'i' to initialize it zero, if the arrow disappears.
After Main Calculation----- below is the code to decide whether to alert buy / sell.
<CODE DELETED>
Please read some other posts before posting . . .
Please edit your post . . . please use the SRC button to post code: How to use the SRC button.
No image attached . . .
Hi Guys,
Please suggest me with a logic to get a alert on the
immediate next candle stick, if the arrow appears and remains constant
on previous candle stick.
Let me explain the image, Buy arrow appears at 22:00hrs and the below code generates a buy alert on the immediate next candle stick i.e 23:00 (which is perfect) works as expected.
Refer Image 1.
Problem Example Refer image 2 : the Arrow appears at 09:00hrs and disappears immediately, then it reappears at 10:00hrs, When this happens variable 'i' increments its value to '2',
which will give a false alert, how can i make variable 'i' to initialize it zero, if the arrow disappears.
After Main Calculation----- below is the code to decide whether to alert buy / sell notification. if (Buy calculation = True) { (Assign variables with calculated values); if (X < 2 && Tempbuy != iTime(NULL, 0, 0)) { PlaySound("Alert2.wav"); // ---------------- Arrow appeared Tempbuy = iTime(NULL, 0, 0); if(i==0) { iref0 = Time[0]; // zeroth candle stick 1st alert, current open time 128.969 @ 20:00 } if(i==1) { iref1 = Time[1]; //Immediate next cabdle stick. switch alert previous open time 128.969 @ current open time = 21:00 } i=i+1; if(i==2) { i=0; } if(iref1 == iref0) { Print("** Macd Xross Up"); message = StringConcatenate(Symbol()," at ", TimePeriod, " BUY Alert : ", " First Alert ",TimeToStr(iref1,TIME_SECONDS)," Stagnant Alert ", TimeToStr(Time[0],TIME_SECONDS)); SendNotification(message); } } //2nd if exit } //main if exit else { // Entering Sell Loop if (Sell calculation = True) { Assign variables with calculated values; if (Y < 2 && Tempsell != iTime(NULL, 0, 0)) { PlaySound("Alert2.wav"); Tempsell = iTime(NULL, 0, 0); if(j==0) { jref0 = Time[0]; // current open time 128.969 } if(j==1) { jref1 = Time[1]; // previous open time 128.969 } j=j+1; if(j==2) { j=0; } if(jref1 == jref0) { Print("** Macd Xross Down"); message = StringConcatenate(Symbol()," at ", TimePeriod, " SELL Alert : ", " First Alert ",TimeToStr(jref1,TIME_SECONDS)," Stagnant Alert ", TimeToStr(Time[0],TIME_SECONDS)); SendNotification(message); } } }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use