♥ 0 |
I would like to create an alert to occur when the stock price is above the Atr trailing stop and the price is 6% or less above the Atr trainling stop. Thanks for your help.
Marked as spam
|
Private answer
No need for code here. I can do this very simply using the Condition Wizard. (well the alert does require a bit of code writing) I can tell I need to do a video on the Condition Wizard. I get a ton of requests for stuff that folks can easily build on their own. If they only knew how to use it. Screenshots below show the steps. Step OneWe begin with a new chart study (blank) and click the Add Condition button. Step TwoFrom the left side select price–> close, in the middle select “is greater than” and from the right side select study–> ATRTralingStop. Step ThreeSame as Step Two accept for this one we select is less than for the middle section. (in order to get this to work we’ll have to add something to the very end of the code that is generated by the condition wizard.) Step FourThe fourth screenshot shows the final result listing the two conditions we added in steps 2 and 3. From here we need to switch to the thinkScript editor. So just click on that tab and…. The fifth screenshot shows the tiny bit of text we need to add to the code. Which is nothing more than multiplying the ATRTrailingStop from the final condition by 1.06. Ok? That is 6% above the second ATRTralingStop. Summary of Steps 1 Through 4First condition checks that the current close is above the ATRTrailingStop. Second condition checks that the current close is below the ATRTrailingStop TIMES 6%. Got that? So when both conditions are true we have the close above the ATRTrailingStop but less than 6% above it. Step FiveStyle the plot. Screenshot 6 shows the plot settings. Here I am setting it to Boolean Down Arrows at the High. I also increased the line weight to make the arrows appear large. Complete. The final screenshot shows the results. The AlertNow adding the alert is a bit more complicated. You have to know how to write and manipulate code in the thinkScript editor. First we take the existing code that was generated at step 4 and use that to define a plot (this will require you to update the study settings to plot this as a boolean down arrow at the high):
All we need now is the alert statement:
Just clear out any existing code from the previous steps and replace them with these last two lines. Marked as spam
|
Please log in to post questions.
Would this alert be based on a Chart Study? Or did you have plans of having this alert sent through SMS/Email?
Alert would be based on a chart study if possible?
I would be happy to just have a line drawn on the chart that is 6% above the ATR trailing stop indicator.
Thanks