Login Page - Create Account

Support Board


Date/Time: Fri, 29 Nov 2024 18:29:30 +0000



Post From: Position size/MM using Simple Alerts

[2023-01-09 03:23:32]
User61168 - Posts: 403
I have yet to run into any limitation yet. This has allowed me to combine multiple strategies into a single alert condition study....very powerful! I also came up with a good way to include comments in my code as there is no way to comment any code (with a minor compromise on cpu load). Which then lead me to find a way to disable alerts since there is no "enable/disable" facility built into a color boar alert condition.

Here's my sample psuedocode for exits:

AND(ID8.SG1=0
,OR(ID8.SG1="StudyName:Buy:ExitManager-OnTick",ID13.SG1=0)
,OR(
OR(ID8.SG1="Exit-OnTick:TP@xxx",AND(ID8.SG1=0,OR(AND(ID7.SG1>0,ID10.SG1+(C-ID9.SG1)>=ID25.SG1+(ID3.SG1+1)*0.25+5),AND(ID7.SG1<0,ID10.SG1+(ID9.SG1-C)>=ID25.SG1+(ID3.SG1+1)*0.25+5)) ))
,OR(ID8.SG1="Exit-OnTick:SL-Fixed-xxxx",AND(ID8.SG1=0,OR(AND(ID7.SG1>0,C<=ID9.SG1-10),AND(ID7.SG1<0,C>ID9.SG1+10)) ))
,OR(ID8.SG1="Exit-OnTick:SL-@xxx",AND(ID8.SG1=0,OR(AND(ID7.SG1>0,C<=ID9.SG1-10,ABS(C-L)<1),AND(ID7.SG1<0,C>ID9.SG1+10,ABS(C-H)<1)) ))
,OR(ID8.SG1="Exit-OnTick:TP@@xxx",AND(ID8.SG1=0,ID10.SG1<=-50,ABS(O-C)<=(H-L)*0.75,OR(AND(ID7.SG1>0,ID10.SG1+(C-ID9.SG1)+(-1)*(ID3.SG1+1)*0.25>=(ID3.SG1+1)*0.25+26.5),AND(ID7.SG1<0,ID10.SG1+(ID9.SG1-C)+(-1)*(ID3.SG1+1)*0.25>=26.5)) ))
,AND(ID8.SG1=0999,OR(
OR(ID8.SG1="Exit-OnTick:TP-xxxxxxx",AND(ID8.SG1=0999,OR(AND(ID7.SG1>0,C>=ID9.SG1+201.50),AND(ID7.SG1<0,C<ID9.SG1-201.50)) ))
,OR(ID8.SG1="Exit-OnTick:xxxxx",AND(ID8.SG1=0999,ID10.SG1<=-50,OR(AND(ID7.SG1>0,C>=ID9.SG1+ABS(ID10.SG1)+(ID3.SG1+1)*0.25+11.50),AND(ID7.SG1<0,C<ID9.SG1-ABS(ID10.SG1)+(ID3.SG1+1)*0.25+11.50 )) ))
))
))

AND(ID8.SG1=0
,OR(ID8.SG1="StudyName:Buy:ExitManager-OnCC",ID13.SG1=0)
,OR(
OR(ID8.SG1="Exit-OnCC:ExitPnL-OnCandleClose",AND(ID8.SG1=0,ID7.SG1<>0 ))
))

Doing it this way allows me to create a Master collection of entries and exits that I can quickly plug n play to explore edges and if I don't need them, I simply comment the code by moving them under ID8.SG1=0999 section to disable. If I need to disable the entire alert condition, I just put a 0999 on the main ID8.SG1 condition (first line). ID8.SG1 is just a simple Line Study defaulted to 0 value, hidden that I use to manage my codeset and to make it more readable. I also use the "alert" tab of ID8 to document my release notes for the study collection, trading results, observations etc... completely in free form text and it does not give me any errors lol (unintended but very convenient 'feature'). I love it... but it takes a hit on market replay performance for us so lately I maintain my entire codeset in notepad++ and only include the code that I am targeting to test.
Piece of cake once you get the hang of it. I have tons of recommendations for improvements on system design but don't want to bother you guys on your journey to add more features which is more important than fixing issues that I have found workarounds for:-
Hope this helps.

p.s. It would be nice to have a disable/enable button in every study in Sierra Chart. Hiding or Ignoring subgraphs is fine but it still results in a waste of few cpu cycles if I am not mistaken. This will allow me to have a static master study collection that I can resuse.

Edit: needless to say, this is not production code as it is very inefficient. I use this only for testing in market replays and then remove all the unnecessary stuff when I am ready to go live
Date Time Of Last Edit: 2023-01-09 04:00:43