- Trends tags:
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.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) 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.Since I love you guys, here’s the macro call for the ATR 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.AverageTrueRange("G1","X");Current_Stock_Holdings.xls!Module1.Stop_loss_ATR;StockChart("OHLC","J1")I use a 20 day time period for my ATR function, as the image above shows. You’ll have substitute “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.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 function, you’ll have to edit the X.X 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.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 file and then import it.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Sub Stop_loss_ATR()'' Stop_loss_ATR Macro' Macro recorded 12/15/2009 by neuralmarkettrends''Range("H1").SelectActiveCell.FormulaR1C1 = "Stop Loss"Range("H21").SelectActiveCell.FormulaR1C1 = "=(RC[-3]-(RC[-1]*X.X))"Range("H21").SelectSelection.NumberFormat = "0.0000"Selection.NumberFormat = "0.000"Selection.NumberFormat = "0.00"Selection.CopyRange("H22:H253").SelectActiveSheet.PasteApplication.CutCopyMode = FalseEnd Sub+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Just a side note, you might be wondering why I call the stockchart function “StockChart("OHLC","J1").” I do that so I can create a nice candlestick chart next to the downloaded data as eye candy.That’s it, there you have it. Now go cause mischief!