HELP!! Daily Pivot modify a popup alert sound !!

 


Daily Pivot modify a pop alert sound



rules :

1 when candle body are closed above R1 line, appears "buy" popup alert sound.

2 when candle body are closed below S1 line, appears "Sell" popup alert sound.

excluded : R2,R3, S2, S3, DP

plz help me :)

Files:
autokpivot.mq4  16 kb
 
Just out of curiosity, what time frame are you using this on?
 

I'm not going to give you the code as this forum is about you learning to code for yourself, but I will give an outline with a few hints:

1. Create a new function at end of code

2. Make sure that it only checks when a new bar has formed.

static datetime currTime;
static bool buy_alert,sell_alert;
if(currTime!=iTime(Symbol(),0/* Current TimeFrame*/,0 /* Last bar*/))return;
if(TimeDayOfWeek(currTime) != TimeDayOfWeek(iTime(Symbol(),0,0)) ){buy_alert=false;sell_alert=false;}
currTime = iTime(Symbol(),0,0);

3. Check if R1_Line exists using ObjectFind() and buy_alert is false. If it does then check if the Bid is greater than price level of the line ( ObjectGet(R1_Line ,OBJPROP_PRICE1) ). If it is then alert and set the buy_alert to true.

4. Do same with S1_Line but replace with less than.

Code that properly and you should get an alert once the bar closes above or below the relevant lines. The TimeDayOfWeek is there to reset the variables on a new day. You may want to add a bit to look back through the rest of the day so that when you change time frames you won't get false alerts.

Hope this is what you were after,

heelflip43

 
nanquan:
Just out of curiosity, what time frame are you using this on?

1 Hour
 
heelflip43:

I'm not going to give you the code as this forum is about you learning to code for yourself, but I will give an outline with a few hints:

1. Create a new function at end of code

2. Make sure that it only checks when a new bar has formed.

3. Check if R1_Line exists using ObjectFind() and buy_alert is false. If it does then check if the Bid is greater than price level of the line ( ObjectGet(R1_Line ,OBJPROP_PRICE1) ). If it is then alert and set the buy_alert to true.

4. Do same with S1_Line but replace with less than.

Code that properly and you should get an alert once the bar closes above or below the relevant lines. The TimeDayOfWeek is there to reset the variables on a new day. You may want to add a bit to look back through the rest of the day so that when you change time frames you won't get false alerts.

Hope this is what you were after,

heelflip43

hi

im not understand mql4 language :)

i need this indicator too, plz help me

thanks

Reason: