NexusFi: Find Your Edge


Home Menu

 





(TS) Print smth when Strategy is disabled from chart


Discussion in EasyLanguage Programming

Updated
    1. trending_up 2,443 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?
Iran Peace Expired NO: Ceasefire on Life Support, OPEC a …
Prediction Markets & Event Contracts
MegaETH Proves the Crowd Right: Prediction Markets Calle …
Prediction Markets & Event Contracts
Election Sunday Resolves: Peru Heads to Runoff at 42pct, …
Prediction Markets & Event Contracts
TradingView Deploys AI to Monitor SEC Filings in Real Ti …
TradingView
Weekend Update: First Qatari LNG Transit Attempted -- IR …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
23 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639


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,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639

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