NexusFi: Find Your Edge


Home Menu

 





(TS) Print smth when Strategy is disabled from chart


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,575 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread

(TS) Print smth when Strategy is disabled from chart

  #1 (permalink)
eronyx
Moldova
 
Posts: 9 since Nov 2017
Thanks Given: 6
Thanks Received: 0

Hi guys
[related to TS coding]

is there a method/function or something that can be coded inside the strategy that will be done before a strategy is disabled?

for example there is such a function
Method override void InitializeComponent()

which is used to code steps when strategy is enabled, but what is the method to code some steps (example : delete a file, delete a global variable) when strategy is removed?

or if anyone could guide me how to delete a global variable / (Item from GlobalDictionary) when a strategy is disabled/removed from chart?

GlobalDictionary is used inside this strategy
PS: trying for few days and still nothing found,
please guide who knows, save a programmer's day

thank you

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Futures True Range Report
The Elite Circle
Deepmoney LLM
Elite Quantitative GenAI/LLM
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
Online prop firm The Funded Trader (TFT) going under?
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
56 thanks
Funded Trader platforms
44 thanks
NexusFi site changelog and issues/problem reporting
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623


eronyx,

you can use the following code to subscribe to the event handler methods that are executed on initialization and un-initialization of your code.

 
Code
{ This method gets called by EasyLanguage one time 
	at the beginning to create and initialize the components }
method override void InitializeComponent()
begin
	self.Initialized += Analysistechnique_Initialized ;	
	self.UnInitialized += Analysistechnique_Uninitialized ;		
end ;
However you ought to check if changes to the global dictionary within the Analysistechnique_Uninitialized method are actually saved, though.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
eronyx
Moldova
 
Posts: 9 since Nov 2017
Thanks Given: 6
Thanks Received: 0

Using it in TS 9.1 and I just need to add the uninitialized events directly without the method override void InitializeComponent(), otherwise getting the following error

Error 1; Description: method ts.StrategyGroups.@@Experiment.initializecomponent(void) method redeclared

thx a lot - this is exactly what I was looking for. You are a saver. I will experiment with global dictionary



ABCTG View Post
eronyx,

you can use the following code to subscribe to the event handler methods that are executed on initialization and un-initialization of your code.

 
Code
{ This method gets called by EasyLanguage one time 
	at the beginning to create and initialize the components }
method override void InitializeComponent()
begin
	self.Initialized += Analysistechnique_Initialized ;	
	self.UnInitialized += Analysistechnique_Uninitialized ;		
end ;
However you ought to check if changes to the global dictionary within the Analysistechnique_Uninitialized method are actually saved, though.

Regards,

ABCTG


Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623

eronyx,

you are welcome.
The code is a full piece of code, including the InitializeComponent call. If you already call this within your code, TS will not call it again and you simply have to add the code that subscribes to the event within the existing method.

Regards,

ABCTG

P.S.: By the way, you can show your appreciation for posts on futures.io by clicking the "Thanks" button next to a post.

Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on November 13, 2017


© 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