Calling ATR and a Stop Loss Macro In TraderXL Pro

Yeah, I still use TraderXL Pro for a bunch of my data manipulation and technical analysis stuff. I use it to download data and run macros through it, macros that I design and then use in my trading screen. After my fucked up 2009 trading year, I had to revamp my entire arsenal of macros and screens for a brighter and more profitable future, I hope.]{style="font-size:10.0pt;"}

[Anyway, below is one of the many macros I use in TraderXL Pro for generating an automatic stop loss using and Average True Range ([ATR]{.small-caps}) function. I then suck this data into my trading screen, and through the use of other magical macros. I then determine if I have to move my stop or sit on my hands.]{style="font-size:10.0pt;"}

[Since I love you guys, here’s the macro call for the [ATR]{.small-caps} function and the stop loss. First name your spreadsheet Current_Stock_Holdings.xls (you can change this later) then copy this into the AutoRun Macro box in BulksquoteXL.]{style="font-size:10.0pt;"}

[AverageTrueRange(“G1″,”[X]{style="background:yellow;"}[]{.push-double}[“]{.pull-double});Current_Stock_Holdings.xls!Module1.Stop_loss_ATR;StockChart(“OHLC”,“J1″)]{style="font-size:10.0pt;"}

[Macro Call

[I use a 20 day time period for my [ATR]{.small-caps} function, as the image above shows. You’ll have substitute[]{.push-double} [“]{.pull-double}X” in the callout function above for the time period you want. It can be 5, 10, 15, or 50, whatever floats your boat and your needs.]{style="font-size:10.0pt;"}

[Once you’ve done this, then you need to copy and paste in the macro for the stop loss function below. Make sure you save it to your spreadsheet locally. As with the [ATR]{.small-caps} function, you’ll have to edit the [X.X]{style="background:yellow;"} that I highlight below to a multiple that you like. It can be 1.5 or 5.5 times the ATR. This will generate wider or tighter stops based on your individual preferences. The smaller the number you input, the tighter the stop you generate. Conversely the larger the number you input, the looser the stop.]{style="font-size:10.0pt;"}

[You can use the Macro Viewer function in TraderXL to import the macro below if you don’t know how to do it manually. Copy and paste the function between the ++++++++’s into a [TXT]{.small-caps} file and then import it.]{style="font-size:10.0pt;"}

[++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]{style="font-size:10.0pt;"}

[Sub Stop_loss_ATR()]{style="font-size:10.0pt;"}

[′]{style="font-size:10.0pt;"}

[′ Stop_loss_ATR Macro]{style="font-size:10.0pt;"}

[′ Macro recorded 12/15/2009 by neuralmarkettrends]{style="font-size:10.0pt;"}

[′]{style="font-size:10.0pt;"}

[′]{style="font-size:10.0pt;"}

[    Range(“H1”).Select]{style="font-size:10.0pt;"}

[    ActiveCell.FormulaR1C1 =[]{.push-double} [“]{.pull-double}Stop Loss”]{style="font-size:10.0pt;"}

[    Range(“H21”).Select]{style="font-size:10.0pt;"}

[    ActiveCell.FormulaR1C1 =[]{.push-double} [“]{.pull-double}=(RC[-3]-(RC[-1]*[X.X]{style="background:yellow;"}))”]{style="font-size:10.0pt;"}

[    Range(“H21”).Select]{style="font-size:10.0pt;"}

[    Selection.NumberFormat =[]{.push-double} [“]{.pull-double}0.0000”]{style="font-size:10.0pt;"}

[    Selection.NumberFormat =[]{.push-double} [“]{.pull-double}0.000”]{style="font-size:10.0pt;"}

[    Selection.NumberFormat =[]{.push-double} [“]{.pull-double}0.00”]{style="font-size:10.0pt;"}

[    Selection.Copy]{style="font-size:10.0pt;"}

[    Range(“H22:H253”).Select]{style="font-size:10.0pt;"}

[    ActiveSheet.Paste]{style="font-size:10.0pt;"}

[    Application.CutCopyMode = False]{style="font-size:10.0pt;"}

[End Sub]{style="font-size:10.0pt;"}

[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]{style="font-size:10.0pt;"}

[Just a side note, you might be wondering why I call the stockchart function[]{.push-double} [“]{.pull-double}StockChart(“OHLC”,“J1″).” I do that so I can create a nice candlestick chart next to the downloaded data as eye candy.]{style="font-size:10.0pt;"}

[That’s it, there you have it. Now go cause mischief!]{style="font-size:10.0pt;"}

Related Posts

Show Comments