NexusFi: Find Your Edge


Home Menu

 





(TS) Print smth when Strategy is disabled from chart


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #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?
The June 15 Resolution Trap: Irans Agreed Text Still Pri …
Prediction Markets & Event Contracts
MyForexFunds Begins Returning Frozen Funds After CFTC Ca …
Funded Trading Evaluation Firms
Rubios Good News Within Hours and the 30-Day Math: Why H …
Prediction Markets & Event Contracts
Sundays Verdict: Lebanon Locked at 99.85% as Iran June 7 …
Prediction Markets & Event Contracts
Trump Truth Social Fires Hormuz From 10% to 59% -- Arsen …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
197 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642


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 X 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,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

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 NexusFi by clicking the "Thanks" button next to a post.


Follow me on X Reply With Quote
Thanked by:




Last Updated on November 13, 2017


© 2026 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 - Downloads - Top
no new posts