Help on simple PSAR Expert Advisor

Alfie Aquino
12
Alfie Aquino  

Hi,

Appreciate if anyone can help me modify EA code below to play sound/alert ONLY when iSAR value transitions from below the bid price to above the ask price and vice versa. Thanks, Alfie.


void OnTick()

{

   string signal="";

   double MySARValue = iSAR(_Symbol,_Period,0.02,0.2,0);

   if (MySARValue<Bid)

   {

    signal = PlaySound ("alert.wav");

    signal = "BUY";

   }

   else

   {

    signal = PlaySound ("alert2.wav");

    signal = "SELL";

   }

   Comment ("MySARValue: ",MySARValue,"\n","Signal: ",signal);   

}

Keith Watford
Moderator
26186
Keith Watford  
Please edit your post and
use the code button (Alt+S) when pasting code

I know that it is not obvious, but topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I will move your topic to the MQL4 and Metatrader 4 section.

William Roeder
23512
William Roeder  
Alfie Aquino: Appreciate if anyone can help me modify EA code below to play sound/alert ONLY when iSAR value transitions from below the bid price to above the ask price and vice versa.
  1. Why did you post your MT4 question in a MT5 section instead of the MQL4 section, (bottom of the Root page)?
              General rules and best pratices of the Forum. - General - MQL5 programming forum?
    Next time post in the correct place. The moderators will likely have moved this thread there soon.

  2. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
              Messages Editor

  3. Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your problem.
              No free help 2017.04.21

    Or pay someone. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum 2018.05.12

  4. You are looking at a signal. Act on a change of signal.
              MQL4 (in Strategy Tester) - double testing of entry conditions - MQL5 programming forum #1 2017.12.12