Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 08:58:59 +0000



Post From: Adding comments to a Study Alert condition

[2023-12-21 00:07:50]
User61168 - Posts: 403
Please convert this thread to "User Discussion" so others could contribute further to their best practice approach

Here's my "coding standards" for simple alerts only. It incorporates the following:
1) comments at the collection level
2) comments at the line/logic level
3) Allows you to enable and disable lines of code quickly
4) maintain entire codeset in notepad++ for a quick cut/paste
5) allows version control specific to different entry and exit criteria
6) allows you to build an entire coding library for future cut/pastes starting from a baseline set of services.
7) allows you to disable all Alert formula studies by setting ID1.SG1 line study to a non-zero value

ID1.SG1 is a simple "Line" study that is present in all my study collections. Go to the Alert tab of this study and enter freeform text on what the collection does, which Sim account you used, cut/paste trading stats, enter chart type used etc etc

For each alert condition/formula, use the following format (during development phase one as this code is not efficient for live trading!)

AND(ID1.SG1=0,OR(
  OR(ID1.SG1="Buy&Sell-ExitOnTick:@DailyMaxPrpfit-ALWAYS",AND(ID1.SG1=0,logic goes here... ))
  ,OR(ID1.SG1="Buy&Sell-ExitOnTick:@DailyMaxLoss-ALWAYS",AND(ID1.SG1=0,logic goes here... ))
  OR(ID1.SG1="Buy&Sell-ExitOnTick:@DailyMaxPrpfit-WhenCondition1Met",AND(ID1.SG1=0,logic goes here... ))
  ,OR(ID1.SG1="Buy&Sell-ExitOnTick:@DailyMaxLoss-WhenCondition1Met",AND(ID1.SG1=0,logic goes here... ))
  
  ,OR(ID1.SG1="Buy&Sell-ExitOnTick:SL-xxx-xxx-xxx",AND(ID1.SG1=0,logic goes here... ))
  ,OR(ID1.SG1="Buy&Sell-ExitOnTick:TP-xxx-xxx-xxx",AND(ID1.SG1=0,logic goes here... ))
  ,AND(ID1.SG1=0888,OR(
   OR(ID1.SG1="Buy&Sell-ExitOnTick:SL-xxx-v1",AND(ID1.SG1=0999,logic goes here... ))
   ,OR(ID1.SG1="Buy&Sell-ExitOnTick:SL-xxx-v2",AND(ID1.SG1=0999,logic goes here... ))
   ,OR(ID1.SG1="Buy&Sell-ExitOnTick:TP-xxx",AND(ID1.SG1=0999,logic goes here... ))
   ))
))


0888 - comments entire block of code
0999 - comments for single logic/code execution

Edit: Line study allows a string value without throwing syntax errors in alert formula at execution.... a blessing in disguise :-))))))))))))
Date Time Of Last Edit: 2023-12-21 00:19:35