0

I am new to AFL programming. what I am trying to do is to launch a console program in my computer using ShellExecute in amibroker AFL to launch my console program with parameters, which in turn contains code expensive logic to place order to my stock broker server.

I first using If condition like

if (Buy[Barcount-1]==1)
{
     ShellExecute("Path/To/Programm.exe","Parameters");
}

I am using One Minute Candle. this code executes when the latest candle generates a Buy signal, but it keeps executing ShellExecute as long as the last candle has a buy signal.

is there a way to limit amibroker to limit ShellExecute cmd once per candle.

Thank you so much in advance.

1 Answers1

0

I would try something like this so it would only trigger when there is a transition to the first buy signal.

if (BarCount > 1 && Buy[Barcount-2]==0 && Buy[Barcount-1]==1)
{
     ShellExecute("Path/To/Programm.exe","Parameters");
}
Ceres
  • 3,524
  • 3
  • 18
  • 25