NexusFi: Find Your Edge


Home Menu

 





File Append Headers - Easylanguage


Discussion in TradeStation

Updated
      Top Posters
    1. looks_one ABCTG with 4 posts (2 thanks)
    2. looks_two Mauro2393 with 4 posts (0 thanks)
    3. looks_3 rolandw85 with 2 posts (1 thanks)
    4. looks_4 SMCJB with 1 posts (1 thanks)
    1. trending_up 4,324 views
    2. thumb_up 4 thanks given
    3. group 12 followers
    1. forum 10 posts
    2. attach_file 0 attachments




 
Search this Thread

File Append Headers - Easylanguage

  #1 (permalink)
 rolandw85 
London
 
Experience: Intermediate
Platform: Tradestation
Trading: equities, options
Posts: 12 since Nov 2019
Thanks Given: 0
Thanks Received: 6

Is it possible to have headers in the first row of the FileAppend function.

Eg: My current code is:
if Marketposition = 1 then
FileAppend("C:\Users\roland\Desktop\DT\Example.csv", Symbolname +","+ Numtostr(date + 19000000,0)+","+ Numtostr(Volume,0)+ Newline);

Is the only way to do this by adding more columns in front of each with a "header"? I just want my CSV to have headers on the top line if possible.

Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
MC PL editor upgrade
MultiCharts
Trade idea based off three indicators.
Traders Hideout
REcommedations for programming help
Sierra Chart
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
My NQ Trading Journal
12 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

Hi rolandw85,

you could write the header within a once block or "if CurrentBar = 1" conditional branching. Depending on how you write your files you might have to add additional checks to make sure the file doesn't exist yet, as FileAppend would otherwise append another header.

Regards,

ABCTG


rolandw85 View Post
Is it possible to have headers in the first row of the FileAppend function.

Eg: My current code is:
if Marketposition = 1 then
FileAppend("C:\Users\roland\Desktop\DT\Example.csv", Symbolname +","+ Numtostr(date + 19000000,0)+","+ Numtostr(Volume,0)+ Newline);

Is the only way to do this by adding more columns in front of each with a "header"? I just want my CSV to have headers on the top line if possible.


Follow me on Twitter Reply With Quote
Thanked by:
  #3 (permalink)
 rolandw85 
London
 
Experience: Intermediate
Platform: Tradestation
Trading: equities, options
Posts: 12 since Nov 2019
Thanks Given: 0
Thanks Received: 6


thanks. good idea. i clear the print log at the end of my code. this will work for what i am after.

Started this thread Reply With Quote
  #4 (permalink)
 
SMCJB's Avatar
 SMCJB 
Houston TX
Legendary Market Wizard
 
Experience: Advanced
Platform: TT and Stellar
Broker: Advantage Futures
Trading: Primarily Energy but also a little Equities, Fixed Income, Metals and Crypto.
Frequency: Many times daily
Duration: Never
Posts: 5,049 since Dec 2013
Thanks Given: 4,384
Thanks Received: 10,206

The annoying thing is, I find that often my header row is actually the 2nd row of the csv file rather than the first, especially if I'm doing optimizations and writing results.

Reply With Quote
Thanked by:
  #5 (permalink)
Mauro2393
Pisa, Italy
 
Posts: 4 since Sep 2020
Thanks Given: 2
Thanks Received: 0


ABCTG View Post
Hi rolandw85,

you could write the header within a once block or "if CurrentBar = 1" conditional branching. Depending on how you write your files you might have to add additional checks to make sure the file doesn't exist yet, as FileAppend would otherwise append another header.

Regards,

ABCTG

Hi,

I'm having some problems with fileappend, I need to save a .txt file for each alert generated by the Strategy filled Order.

could you please help me?

Reply With Quote
  #6 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

Mauro2393,

what problems are you having?

Someone might be able to steer you into the right direction if you post the code that is giving you the problems.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #7 (permalink)
Mauro2393
Pisa, Italy
 
Posts: 4 since Sep 2020
Thanks Given: 2
Thanks Received: 0


ABCTG View Post
Mauro2393,

what problems are you having?

Someone might be able to steer you into the right direction if you post the code that is giving you the problems.

Regards,

ABCTG

I sent to you a message, anyway I will Explain here what i'm looking for.

I would need to write a few lines of code that would allow me to save as a text file all the alerts or emails generated by the Strategy Filled Order function of TradeStation's TradeManager.

if anyone can help me or write me a piece of code I would be very happy.

Reply With Quote
  #8 (permalink)
Mauro2393
Pisa, Italy
 
Posts: 4 since Sep 2020
Thanks Given: 2
Thanks Received: 0


ABCTG View Post
Mauro2393,

what problems are you having?

Someone might be able to steer you into the right direction if you post the code that is giving you the problems.

Regards,

ABCTG

Hi @ABCTG

this is the code that i have, i need that print just ones when change position (long, Flat, Short)

If i_mp = -1 then
string_text=symb_+","+"Sell"+","+"Market"+","+VersioneStrategia+newline;
Fileappend(string_path2,string_text);

Reply With Quote
  #9 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

Mauro2393,

using the OrderFill event of a StrategyHost as outlined here https://community.tradestation.com/Discussions/Topic.aspx?Topic_ID=162710 might be the better approach as this way you can also get prints for partial fills or only print in case you are fully filled.

Regards,

ABCTG


Mauro2393 View Post
Hi @ABCTG

this is the code that i have, i need that print just ones when change position (long, Flat, Short)

If i_mp = -1 then
string_text=symb_+","+"Sell"+","+"Market"+","+VersioneStrategia+newline;
Fileappend(string_path2,string_text);


Follow me on Twitter Reply With Quote
  #10 (permalink)
Mauro2393
Pisa, Italy
 
Posts: 4 since Sep 2020
Thanks Given: 2
Thanks Received: 0


Hi @ABCTG

I've already tried with strategy host but seems to be working only with the Simulated account, my algorithm is for Forex and as you know forex is not anymore available on TradeStation.
this is the reason why I was asking something inside the code without using strategy host.
Do you know an easy way to do it?
Kind Regards,


ABCTG View Post
Mauro2393,

using the OrderFill event of a StrategyHost as outlined here might be the better approach as this way you can also get prints for partial fills or only print in case you are fully filled.

Regards,

ABCTG


Reply With Quote




Last Updated on September 16, 2020


© 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