my alertif loops is not working properly.
AlertIF( Buy, "EXEC D:\xyz\Buy\"+ Name() +".exe", "Launching external application", 3 );
AlertIF( Buy, "EXEC D:\abc\Buy\"+ Name() +".exe", "Launching external application", 3 );
when buy signal comes only the first alertif works but the 2nd one doesnt why is that?
@tarscase1, probably for the same reason explained here by @Tomasz.
Please, read again the documentation to understand how it works.
- Please ... note that by default AlertIf function does not generate repetitive signals when the same scan is run multiple times. During experimentation you may prefer to get repeated signals in subsequent scans. To do so you should change default flags to 1 + 2:
AlertIF( condition, "", "Text", 1, 1+2 );
If this does not solve the problem, search the Forum for other thread related to "alertif" to see similar issues, solutions, and alternatives.
@tarscase1 - first thing - please read the docs carefully, including "Internal logic" part from https://www.amibroker.com/guide/h_alerts.html - it clearly explains that multiple repeated signals of the same type (and your type is 3 for both calls) are IGNORED.
Second thing - use the CODE TAGS as your code is UNREADABLE without them.
I have question regarding alertif type and I think the best way is to put my question here since you mentioned about alertif type here.
Should we define the type variable if we want to create alertif other than 1=buy 2=sell 3=short 4=cover?
I have 6 alertif criteria, and 4 of them is not type 1/2/3/4.
That's not possible.How can you have a trade execution that is NOT either a Buy/Sell/Short/ShortCover for your AlertIf function?
In fact AlertIf would accept numbers other than 1-4, and it will list all alerts >= 5 as "Other" type but will distinguish between different values (so they are not treated as "repeated").