NexusFi: Find Your Edge


Home Menu

 





PC-SPAN


Discussion in Options

Updated
      Top Posters
    1. looks_one Dudetooth with 218 posts (213 thanks)
    2. looks_two ron99 with 116 posts (55 thanks)
    3. looks_3 CafeGrande with 30 posts (4 thanks)
    4. looks_4 BlueRoo with 24 posts (5 thanks)
      Best Posters
    1. looks_one Dudetooth with 1 thanks per post
    2. looks_two SMCJB with 1 thanks per post
    3. looks_3 ron99 with 0.5 thanks per post
    4. looks_4 BlueRoo with 0.2 thanks per post
    1. trending_up 191,244 views
    2. thumb_up 317 thanks given
    3. group 75 followers
    1. forum 610 posts
    2. attach_file 159 attachments




 
Search this Thread

PC-SPAN

  #191 (permalink)
 Dudetooth 
Steubenville Ohio
 
Experience: Intermediate
Platform: OX, OEC, RJO
Trading: Options on Futures
Posts: 266 since Sep 2012
Thanks Given: 30
Thanks Received: 274


BlueRoo View Post
The issue is that the calMargin code in XLS SPAN consistently seems to change the spread number of the last spread in Col F.

I fixed that issue by leaving the Col F alone if there was an existing value.

I also wanted a way to track all my positions on the Tracker tab with one click. The code I came up with runs through each position and as long as all positions of the spread have the same number in Col F and are adjacent they will be calculated as a spread, one spread at a time. Then it calculates all the remaining positions individually. My code might not match up with yours because I have modified the Track Spread to accommodate more than two positions, but if you are interested I can get you the code.

Also, if you are interested in tracking several positions historically I'd suggest looking at running that through the Tracker rather than the Historic tab (use code to change date on Scanner, track positions on Tracker, and save the data ... then examine results in a pivot table).

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
Cheap historycal L1 data for stocks
Stocks and ETFs
 
  #192 (permalink)
BlueRoo
Brisbane, Queensland, Australia
 
Posts: 121 since Aug 2013
Thanks Given: 75
Thanks Received: 97


Dudetooth View Post
I fixed that issue by leaving the Col F alone if there was an existing value.

I also wanted a way to track all my positions on the Tracker tab with one click. The code I came up with runs through each position and as long as all positions of the spread have the same number in Col F and are adjacent they will be calculated as a spread, one spread at a time. Then it calculates all the remaining positions individually. My code might not match up with yours because I have modified the Track Spread to accommodate more than two positions, but if you are interested I can get you the code.

Also, if you are interested in tracking several positions historically I'd suggest looking at running that through the Tracker rather than the Historic tab (use code to change date on Scanner, track positions on Tracker, and save the data ... then examine results in a pivot table).

I have not modified any of the code in my copy of your file. Can you post how you fixed the code so Col F is not modified by calMargin(3,0).

Yes, I am interested in getting the code you have for updating all positions on tracker with one click. I am sure we have both done it slightly differently. But looking at both may produce the better code.

Yes, in my shell code I have tracker positions being record historically for each EOD Risk File, so that positions can be seen through DTE.

Reply With Quote
  #193 (permalink)
 Dudetooth 
Steubenville Ohio
 
Experience: Intermediate
Platform: OX, OEC, RJO
Trading: Options on Futures
Posts: 266 since Sep 2012
Thanks Given: 30
Thanks Received: 274



BlueRoo View Post
Can you post how you fixed the code so Col F is not modified ... Yes, I am interested in getting the code you have for updating all positions on tracker with one click.

Here's what I came up with. The fix for the Col F is built into the modified CalcMargin sub.

It will no longer prompt you to select each side of the spread. It is now like the Track Select ... highlight the positions in your spread and then click the Track Spread button. If it is a new spread (no number in Col F) it will give it a number. If it already has a number in Col F it leaves it as is. I've tested it with spreads that have four legs and it works fine, theoretically it should be able to handle as many legs as you want in a spread (the next step for true portfolio margin calculation). It will also add two new columns of info: AE is the current ROI if position was exited early and AF is the current $ P/L.

It should be a simple swap-out of the existing subs in your spreadsheet with those attached ... just let me know if you have any trouble with it.

If you don't mind sharing, how are you analyzing the data you get tracking multiple positions through the tracker ... are you just running it in a pivot table or something else?

Attached Files
Elite Membership required to download: Mod Code.txt
Reply With Quote
  #194 (permalink)
BlueRoo
Brisbane, Queensland, Australia
 
Posts: 121 since Aug 2013
Thanks Given: 75
Thanks Received: 97

Your modified calcMargin has a call to a new function called optionvalue. Could you post this missing code.

Yes I am happy to share what I am doing with my shell code optionanalysis.xls. I will post this later. Essentially I am looking at the data your engine provides and processing it graphically and statistically.

Not sure what your plans are for your code but it has been a great help.

Is the code to scan risk files in your default directory of any value?

I am very happy to contribute whatever I can as a sign of appreciation for the work you have already done.

You probably can already tell that I am not essentially a coder. I am more of a app designer and architect. But I can code and have been for 15 years to support my trading activity. My code will just be a little messy and in the past has be reworked by coders after a prototype or design stage (app work I have done in CRM during my career).

Reply With Quote
  #195 (permalink)
 Dudetooth 
Steubenville Ohio
 
Experience: Intermediate
Platform: OX, OEC, RJO
Trading: Options on Futures
Posts: 266 since Sep 2012
Thanks Given: 30
Thanks Received: 274


BlueRoo View Post
Your modified calcMargin has a call to a new function called optionvalue. Could you post this missing code.

Here are the missing functions. If there are too many more missing parts I can look to post my latest spreadsheet (after a while you lose track of all the changes you make).


BlueRoo View Post
Essentially I am looking at the data your engine provides and processing it graphically and statistically ... Not sure what your plans are for your code ...

I am looking forward to seeing the way you are processing and analyzing the data. Right now I mainly use this for risk management, but I have been looking more at back-testing ideas ... mainly with spreads. That and I'd love to have full portfolio margin calculation, but right now that looks pretty daunting.


BlueRoo View Post
Is the code to scan risk files in your default directory of any value?

I'm not sure I fully understand your question. Were you asking about the code I use to list the pa2 files? If so, I have included that with the attachment ... if not please help me to understand what you asking.


BlueRoo View Post
I am very happy to contribute whatever I can

Thank you ... I always love getting a glimpse at what other people are doing with their analysis.

Attached Files
Elite Membership required to download: OptionValue.txt
Reply With Quote
  #196 (permalink)
BlueRoo
Brisbane, Queensland, Australia
 
Posts: 121 since Aug 2013
Thanks Given: 75
Thanks Received: 97

The optionValue Function is what I was missing.

I will test the Listpas2Files Procedure. It is similar to the code for the same task that I posted earlier. But it actually reports the date range for the saved risk files. Yours rebuild the list in Col A. My approach is to say you don't need Col A. If you know the date range of your save risk files (which my code reports to the user in the input box) then the dates for the selected date range can be directly entered into Col F. At this moment my approach does not remove the dates with no returned data. Visually I find this easier to look at in bock so weeks. My approach would be then to removed dates with no returned data when I take the time series and move it for analysis. This is because when presenting the time series in a chart two axis's are required. I chart vol and delta on one axis and option price on the other. why because of the different numbers, it is easier to reformat vol and delta to normal decimal numbers e.g. vol at 20% becomes .2 and delta of 20 becomes .2 - therefore the two values are compatible for assignment to a secondary access in a chart which then leaves the primary axis for option price. (let me know if this is not clear.) So you will be able to deduce that I reprocess the data from tracker and historic into newly formatted data sets for analysis.

Use for analysis. Yes we are thinking alike. I see your file useful for both risk management and candidate search.

The ability to retrieve both snapshot and time series data sets is the key. An ability without the work you have down I would not have access too. Again thank you.

Yes, if you wish to develop the code further and I can help maybe a current XLS SPAN file is a good idea.

Reply With Quote
  #197 (permalink)
BlueRoo
Brisbane, Queensland, Australia
 
Posts: 121 since Aug 2013
Thanks Given: 75
Thanks Received: 97

Okay I see you have removed the input boxes. Now you simply need to select the vertical cels for the spread you wish to trade and click track spread. This great.

The code I have goes the next step. if there are 10 spreads in tracker, with one click the are all process without any need for the user to selected any cells.

Reply With Quote
  #198 (permalink)
 Dudetooth 
Steubenville Ohio
 
Experience: Intermediate
Platform: OX, OEC, RJO
Trading: Options on Futures
Posts: 266 since Sep 2012
Thanks Given: 30
Thanks Received: 274


BlueRoo View Post
The optionValue Function is what I was missing.

If you do any grains you'll need the GrainValue function as well.


BlueRoo View Post
Yours rebuild the list in Col A.

I went the lazy way ... it was the easiest way to get things done. If I wanted to test how an idea would have worked last year at this time, I set my historic dates to start on 5/10/13. I have no idea what day of the week that was, but the code will find the closest pa2 file I have in my folder and then give me dates for the next 30 trade dates. I understand the angle you are going, I just found it easier to simply have a list of the dates available and grab from that. It's a horse apiece I guess.


BlueRoo View Post
So you will be able to deduce that I reprocess the data from tracker and historic into newly formatted data sets for analysis.

I left the rough code I have been using for back-testing along with a sample of the results on the Tracker tab so you can see the route I was taking. Unfortunately, you have to dig through the code in the Backtest module a bit (I don't have all the user-friendly buttons for these subs).

I have focusing primarily on the price to see if an idea is viable, but I could see where incorporating other variables would be beneficial. Any ideas on tweaking the back-testing would be appreciated.


BlueRoo View Post
The code I have goes the next step. if there are 10 spreads in tracker, with one click the are all process without any need for the user to selected any cells.

The code that is in for Track All will calculate for spreads and individual positions alike. Once a spread has been identified (you used Track Spread on multiple rows and they now have a number in Col F), click Track All and it will calculate each spread down the list and then the remaining individual positions. Try it on the one I uploaded to see what I'm talking about.

There's a couple of other tweaks in there from the last release, pretty much my "work in progress" spreadsheet.

Attached Files
Elite Membership required to download: XLS-SPAN (04b).xls
Reply With Quote
  #199 (permalink)
BlueRoo
Brisbane, Queensland, Australia
 
Posts: 121 since Aug 2013
Thanks Given: 75
Thanks Received: 97

Appreciate the new file. It is considerably larger and with a quick look at the code there is a bit to take in.

I feel that I should apologize. I see my suggestions where redundant. You are doing a great job on improving what is already a tool that has real value.

So rather than stepping on your toes I would be happy to take your direction on testing anything you wish to have checked.

The back-testing is a fantastic addition.

Here are two screen shows that are generated on the fly by the code in my option analysis file that utilises the data from your file. This is a snapshot. Based on the option chain.



Reply With Quote
Thanked by:
  #200 (permalink)
 Dudetooth 
Steubenville Ohio
 
Experience: Intermediate
Platform: OX, OEC, RJO
Trading: Options on Futures
Posts: 266 since Sep 2012
Thanks Given: 30
Thanks Received: 274


No need to apologize. I hope I didn't come across as dismissing your ideas, I just hadn't thought about posting what I have been toying with in the spreadsheet until I saw that you had fixed some of the same issues I had found.

I don't really have any direction I am going with the spreadsheet right now. My main focus is to come up with some new trading ideas, so I have been looking at the back-testing. Normally, I come up with new tools as I run into issues/problems or when I see what other folks are doing.

From the looks of your spreadsheet, I highly doubt that you would be stepping on any toes with me ... screenshots look impressive. I must admit that I immediately wanted to take a look "under the hood" and see what you have in there. If/when your are willing to share some details, I'd love to see some the tools you have developed and get a glimpse of the way you are analyzing potential trades.

Reply With Quote




Last Updated on September 23, 2021


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts