NexusFi: Find Your Edge


Home Menu

 





EasyLanguage and Excel - An Example


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one Big Mike with 1 posts (0 thanks)
    2. looks_two arjfca with 1 posts (0 thanks)
    3. looks_3 TraderDoc2 with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 11,891 views
    2. thumb_up 11 thanks given
    3. group 6 followers
    1. forum 3 posts
    2. attach_file 3 attachments




 
Search this Thread

EasyLanguage and Excel - An Example

  #1 (permalink)
 
ericbrown's Avatar
 ericbrown 
Tulsa, OK
 
Experience: Advanced
Platform: Tradestation, TOS, Python
Broker: IQFeed, Tradestation, TOS
Trading: ES, SPY, Options
Posts: 201 since Jan 2011
Thanks Given: 339
Thanks Received: 258

Just wanted to share a quick example of how I'm using the Excel Class within TradeStation (ver 9.x). The Excel Class is documented pretty well and a demo is provided at https://community.tradestation.com/Discussions/Topic.aspx?Topic_ID=114780 (not sure if its OK to share that demo file here...so I'm just linking to it for those of you who have TradeStation accounts).

Some background:

I like to calculate my own pivots for indexes, futures and some stocks. I use these pivots as a general area of support/resistance and/or inflection. I use CSI Unfair Advantage for data and run an R script to pull data from CSI UA and then write out my Pivots.xls file every morning. This file is then used to auto-load my pivots, R's and S's in TradeStation .

The code below will read from the excel spreadsheet with worksheet name in the row given starting in the column given. It will then draw the Pivot, R's and S's on the chart for that symbol. I've attached the ELD, TXT version and my Pivots.xls file for your review.

Hope this is useful for others working with Excel and Tradestation. If you find any errors with this, let me know...i've been using it without issue for a few days now.

To use this, import the ELD and put the XLS on your "C:\" Drive (or change the path to the XLS to wherever you'd like to save it).

 
Code
{ set the namespaces that will be used }
using elsystem.office.excel ;
using elsystem.collections ;
using elsystem ;

{Inputs}
inputs:
    string WorkbookName( "C:\Pivots.xls" ), { The path, filename, and extension must be correct for the file. }
    string SheetName( "Pivots" ), { sheet where the information is located }
    TimeBegin(0001), 
    TimeEnd(2359),
    int column_cell(3), {this is the excel column that the Pivot is in. The program then takes and adds +1 to each column for he next # }
    int row_cell(6); {this is the row in the excel sheet for this symbol.}
    
{Set my variables}    
variables:
    float PivotPoint (0.00),
    float R1(0.00),
    float R2(0.00),
    float R3(0.00),
    float S1(0.00),
    float S2(0.00),
    float S3(0.00),
    Workbook WB1( NULL ); { Workbook object }
    

    
    { instantiate a new Workbook object and set its properties.}
    once WB1 = new Workbook ;
    once WB1.FileName = WorkbookName ;
    once WB1.Shared = true ;
    once WB1.Visible = false ;
    once WB1.Load = true ;
    once WB1.SaveOnClose = false ;
    


{ Get the pivot, R's and Support's from the excel file }
once PivotPoint = WB1.sheets[SheetName].CellsAsDouble[column_cell,row_cell] ;
once R1 = WB1.sheets[SheetName].CellsAsDouble[column_cell+1,row_cell] ;
once R2 = WB1.sheets[SheetName].CellsAsDouble[column_cell+2,row_cell] ;
once R3 = WB1.sheets[SheetName].CellsAsDouble[column_cell+3,row_cell] ;
once S1 = WB1.sheets[SheetName].CellsAsDouble[column_cell+4,row_cell] ;
once S2 = WB1.sheets[SheetName].CellsAsDouble[column_cell+5,row_cell] ;
once S3 = WB1.sheets[SheetName].CellsAsDouble[column_cell+6,row_cell] ;


{Set Pivot}
Value1=TL_New(D,TimeBegin,PivotPoint,D,    TimeEnd,PivotPoint);
    TL_SetColor(Value1,cyan);
    TL_SetSize(Value1,0);
    TL_SetStyle(Value1,Tool_dotted);
    TL_SetExtRight(Value1,TRUE);
    
{Set S1}
Value3=TL_New(D,TimeBegin,S1,D,    TimeEnd,S1);
    TL_SetColor(Value3,RGB(255,128,0));
    TL_SetSize(Value3,0);
    TL_SetStyle(Value3,Tool_dotted);
    TL_SetExtRight(Value3,TRUE);

{Set S2}
Value5=TL_New(D,TimeBegin,S2,D,TimeEnd,S2);
    TL_SetColor(Value5,RGB(255,128,0));
    TL_SetSize(Value5,0);
    TL_SetStyle(Value5,Tool_dotted);
    TL_SetExtRight(Value5,TRUE);

{Set S3}
Value7=TL_New(D,TimeBegin,S3,D,TimeEnd,S3);
    TL_SetColor(Value7,RGB(255,128,0));
    TL_SetSize(Value7,0);
    TL_SetStyle(Value7,Tool_dotted);
    TL_SetExtRight(Value7,TRUE);

{Set R1}
Value9=TL_New(D,TimeBegin,R1,D,TimeEnd,R1);
    TL_SetColor(Value9,RGB(255,84,76));
    TL_SetSize(Value9,0);
    TL_SetStyle(Value9,Tool_dotted);
    TL_SetExtRight(Value9,TRUE);

{Set R2}
Value11=TL_New(D,TimeBegin,R2,D,TimeEnd,R2);
    TL_SetColor(Value11,RGB(255,84,76));
    TL_SetSize(Value11,0);
    TL_SetStyle(Value11,Tool_dotted);
    TL_SetExtRight(Value11,TRUE);

{Set R3}
Value13=TL_New(D,TimeBegin,R3,D,TimeEnd,R3);
    TL_SetColor(Value13,RGB(255,84,76));
    TL_SetSize(Value13,0);
    TL_SetStyle(Value13,Tool_dotted);
    TL_SetExtRight(Value13,TRUE);

Attached Files
Elite Membership required to download: CUSTOM_PIVOTS_CSV.ELD
Elite Membership required to download: Pivots.xls
Elite Membership required to download: CUSTOM_PIVOTS_CSV.TXT
Follow me on Twitter Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
Exit Strategy
NinjaTrader
 

  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,392 since Jun 2009
Thanks Given: 33,170
Thanks Received: 101,530


Very nice, thanks for sharing.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 arjfca 
Montreal, Canada
 
Experience: Intermediate
Platform: Multicharts
Broker: Interactive Broker
Trading: Forex
Posts: 263 since Sep 2010
Thanks Given: 440
Thanks Received: 91


ericbrown View Post
Just wanted to share a quick example of how I'm using the Excel Class within TradeStation (ver 9.x). The Excel Class is documented pretty well and a demo is provided at https://community.tradestation.com/Discussions/Topic.aspx?Topic_ID=114780 (not sure if its OK to share that demo file here...so I'm just linking to it for those of you who have TradeStation accounts).

Some background:

I like to calculate my own pivots for indexes, futures and some stocks. I use these pivots as a general area of support/resistance and/or inflection. I use CSI Unfair Advantage for data and run an R script to pull data from CSI UA and then write out my Pivots.xls file every morning. This file is then used to auto-load my pivots, R's and S's in TradeStation .

The code below will read from the excel spreadsheet with worksheet name in the row given starting in the column given. It will then draw the Pivot, R's and S's on the chart for that symbol. I've attached the ELD, TXT version and my Pivots.xls file for your review.

Hope this is useful for others working with Excel and Tradestation. If you find any errors with this, let me know...i've been using it without issue for a few days now.

To use this, import the ELD and put the XLS on your "C:\" Drive (or change the path to the XLS to wherever you'd like to save it).

 
Code
{ set the namespaces that will be used }
using elsystem.office.excel ;
using elsystem.collections ;
using elsystem ;

{Inputs}
inputs:
    string WorkbookName( "C:\Pivots.xls" ), { The path, filename, and extension must be correct for the file. }
    string SheetName( "Pivots" ), { sheet where the information is located }
    TimeBegin(0001), 
    TimeEnd(2359),
    int column_cell(3), {this is the excel column that the Pivot is in. The program then takes and adds +1 to each column for he next # }
    int row_cell(6); {this is the row in the excel sheet for this symbol.}
    
{Set my variables}    
variables:
    float PivotPoint (0.00),
    float R1(0.00),
    float R2(0.00),
    float R3(0.00),
    float S1(0.00),
    float S2(0.00),
    float S3(0.00),
    Workbook WB1( NULL ); { Workbook object }
    

    
    { instantiate a new Workbook object and set its properties.}
    once WB1 = new Workbook ;
    once WB1.FileName = WorkbookName ;
    once WB1.Shared = true ;
    once WB1.Visible = false ;
    once WB1.Load = true ;
    once WB1.SaveOnClose = false ;
    


{ Get the pivot, R's and Support's from the excel file }
once PivotPoint = WB1.sheets[SheetName].CellsAsDouble[column_cell,row_cell] ;
once R1 = WB1.sheets[SheetName].CellsAsDouble[column_cell+1,row_cell] ;
once R2 = WB1.sheets[SheetName].CellsAsDouble[column_cell+2,row_cell] ;
once R3 = WB1.sheets[SheetName].CellsAsDouble[column_cell+3,row_cell] ;
once S1 = WB1.sheets[SheetName].CellsAsDouble[column_cell+4,row_cell] ;
once S2 = WB1.sheets[SheetName].CellsAsDouble[column_cell+5,row_cell] ;
once S3 = WB1.sheets[SheetName].CellsAsDouble[column_cell+6,row_cell] ;


{Set Pivot}
Value1=TL_New(D,TimeBegin,PivotPoint,D,    TimeEnd,PivotPoint);
    TL_SetColor(Value1,cyan);
    TL_SetSize(Value1,0);
    TL_SetStyle(Value1,Tool_dotted);
    TL_SetExtRight(Value1,TRUE);
    
{Set S1}
Value3=TL_New(D,TimeBegin,S1,D,    TimeEnd,S1);
    TL_SetColor(Value3,RGB(255,128,0));
    TL_SetSize(Value3,0);
    TL_SetStyle(Value3,Tool_dotted);
    TL_SetExtRight(Value3,TRUE);

{Set S2}
Value5=TL_New(D,TimeBegin,S2,D,TimeEnd,S2);
    TL_SetColor(Value5,RGB(255,128,0));
    TL_SetSize(Value5,0);
    TL_SetStyle(Value5,Tool_dotted);
    TL_SetExtRight(Value5,TRUE);

{Set S3}
Value7=TL_New(D,TimeBegin,S3,D,TimeEnd,S3);
    TL_SetColor(Value7,RGB(255,128,0));
    TL_SetSize(Value7,0);
    TL_SetStyle(Value7,Tool_dotted);
    TL_SetExtRight(Value7,TRUE);

{Set R1}
Value9=TL_New(D,TimeBegin,R1,D,TimeEnd,R1);
    TL_SetColor(Value9,RGB(255,84,76));
    TL_SetSize(Value9,0);
    TL_SetStyle(Value9,Tool_dotted);
    TL_SetExtRight(Value9,TRUE);

{Set R2}
Value11=TL_New(D,TimeBegin,R2,D,TimeEnd,R2);
    TL_SetColor(Value11,RGB(255,84,76));
    TL_SetSize(Value11,0);
    TL_SetStyle(Value11,Tool_dotted);
    TL_SetExtRight(Value11,TRUE);

{Set R3}
Value13=TL_New(D,TimeBegin,R3,D,TimeEnd,R3);
    TL_SetColor(Value13,RGB(255,84,76));
    TL_SetSize(Value13,0);
    TL_SetStyle(Value13,Tool_dotted);
    TL_SetExtRight(Value13,TRUE);

Hello

I don't have access to TradeStation site and I got interogation. Maybe a dummy question

What kind of functions could you get using using elsystem.office.excel ;

Do you know if this file is compatible with Multicharts?

I'm working with Multicharts and I'm looking to convert to MC 64. But I need to find a way to keep my connection with Excel.

Have a good day
Martin

Reply With Quote





Last Updated on January 31, 2013


© 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