Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- <<< Performance-Friendly debug window, by TazoTodua#gmail.com >>>
- ::::::::: USAGE :::::::::::
- In indicator, insert this in host-script:
- vars: string text_to_formlog("");
- Method void PrintCL(string a1) begin
- text_to_formlog = a1;
- Value1 = tt_formlog(text_to_formlog);
- end;
- Then, in the execution start:
- Once value1= tt_formLog("reset");
- Then insert printouts anywhere:
- PrintCL("hellooo");
- PrintCL(Close.ToString());
- Then on chart click CTRL+MouseClick and you will see log window.
- }
- using elsystem;
- using elsystem.collections;
- Using charting;
- Using platform;
- using elsystem.windows.forms;
- Inputs:
- object passed_object(objectSimple);
- vars:
- GlobalDictionary thisChart_formLogs(null),
- int i_(0),
- int y_ (0)
- ;
- var: string passed_text("");
- vars:
- ChartingHost ChartingHost1( NULL );
- // ================ for initialization of form ======================//
- method void AnalysisTechnique_Initialized( elsystem.Object sender, elsystem.InitializedEventArgs args )
- begin
- Print("init");
- Print(passed_text);
- // AVOID MULTIPLE INITIALIZATIONS ! ! !
- If ( passed_text="reset") then begin // ChartingHost1 = Null and
- Print("rst");
- InitChartingHost();
- end;
- end;
- //
- method void InitChartingHost()
- begin
- chartinghost1 = new ChartingHost;
- chartinghost1.Name = "chartinghost1";
- thisChart_formLogs= null;
- chartinghost1.chartelementclick += chartinghost1_chartelementclick;
- end;
- {
- method void tableCreate(string keyMember) begin
- TableLayoutPanel1.RowStyles.Clear();
- TableLayoutPanel1.ColumnStyles.Clear();
- // int allWords = gs.punctuations.Count();
- TableLayoutPanel1.RowCount = 4;
- // TableLayoutPanel2.ColumnCount = 1;
- // float eachSize = 20 / 100; // tableLayoutPanel1.Height / allWords;
- tableLayoutPanel1.ColumnStyles.Add( new ColumnStyle( SizeType.Percent, 100) );
- i_ = 0;
- //For y_ = 0 to formLogs[keyMember].count-1 begin
- tableLayoutPanel1.RowStyles.Add( new RowStyle(20, 100));
- // formLogs[formLogs.Keys[y_].ToString()] astype string
- tableLayoutPanel1.Controls.Add( Label.Create( "ss", 20, 100 ), 0, y_);
- //end;
- //tableLayoutPanel1.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;
- end;
- }
- method void ChartingHost1_ChartElementClick( elsystem.Object sender, charting.ChartElementClickEventArgs args )
- vars:
- BarVisualElement barElement, string finalTxt;
- begin
- // barnumber[0] ----> LastBarNumber
- //args.time -------> 25-May-18 8:00:00 PM
- finalTxt="";
- if (not Form1.Visible) and args.IsKeyDown[Key.control] then Form1.Show();
- If Form1.Visible then begin
- //if clicked onto bar
- try
- if(args.Element <> null) then begin
- barElement = args.Element astype BarVisualElement ;
- finalTxt = "-----barElement.BarsAgo" + barElement.BarsAgo.ToString();
- end;
- //PrintCL( (barnumber[0]-barElement.BarsAgo).ToString() + " - BarNumber");
- //AppStorage["DebugBar"] = (barnumber[0]-barElement.BarsAgo) astype int;
- // AppStorage["DebugDate"] <> null and bardatetime = AppStorage["DebugDate"] astype DateTime; //DateTime.Parse("1/1/1")
- catch (exception ex)
- //AppStorage["DebugBar"] = 0 astype int;
- end;
- //tableCreate(args.time.ToString());
- if(thisChart_formLogs.Contains(args.time.ToString())) then begin
- TextBox1.Text = thisChart_formLogs[args.time.ToString()].ToString();
- end
- Else begin
- TextBox1.Text = "";
- end;
- end;
- end;
- // ======= init ======== //
- print(SO_Clock_wMS + " : obj_conversion START");
- If passed_object istype string then passed_text = passed_object.ToString()
- Else if
- passed_object istype double or
- passed_object istype int or
- passed_object istype bool
- then
- passed_text = passed_object.ToString()
- Else
- passed_text = passed_object.ToString();
- print(SO_Clock_wMS.ToString() + " : Word: " + passed_text.ToString());
- print(SO_Clock_wMS + " : obj_conversion END");
- vars: added_ (""), string barDt("");
- Form1.TopMost = true;
- barDt = bardatetime.ToString();
- If (passed_text = "reset") then begin
- Once begin
- print(SO_Clock_wMS + " : RESET + DictCreate START !!!!!!!");
- thisChart_formLogs= null;
- thisChart_formLogs = GlobalDictionary.Create(false, tt_chartname );
- print(SO_Clock_wMS + " : RESET + DictCreate END");
- end;
- end
- Else begin
- Once begin
- print(SO_Clock_wMS + " : DictCreate START !!!!!!!");
- thisChart_formLogs = GlobalDictionary.Create(false, tt_chartname );
- print(SO_Clock_wMS + " : DictCreate END");
- end;
- added_ = "";
- if ( thisChart_formLogs.Contains( barDt ) ) then begin
- print(SO_Clock_wMS + " : added START");
- added_ = thisChart_formLogs[barDt].ToString() + NewLine;
- print(SO_Clock_wMS + " : added END");
- end;
- print(SO_Clock_wMS + " : arrayMember START ");
- thisChart_formLogs[barDt] = added_ + passed_text;
- print(SO_Clock_wMS + " : arrayMember END");
- end;
- tt_print=0;
Add Comment
Please, Sign In to add comment