Trend Lince drawing: Amateur question

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Trend Lince drawing: Amateur question

Postby arjfca » 17 Dec 2013

Hello

My code is drawing a trend line. After a very short time, the trend line disappear.

How should I code to have it stay on screen

Code: Select all

//Read Trend line file and set them on the chart

Var:
Intrabarpersist Filename (""),
Intrabarpersist TL_String (""),
Intrabarpersist TL_Num (0),
Intrabarpersist TL_Num_Ex (0),
Intrabarpersist TL_First (0),
Intrabarpersist TL_Last (0),
Intrabarpersist List_String (""),
Intrabarpersist TL_Num_String (0),
Intrabarpersist TL_Price_S (0),
Intrabarpersist TL_Price_E (0),
Intrabarpersist TL_Time_S (0),
Intrabarpersist TL_Time_E (0),
Intrabarpersist TL_Color (0),
Intrabarpersist Tl_Style (0),
Intrabarpersist TL_Size (0),
Intrabarpersist TL_Ext_L (False),
Intrabarpersist TL_Ext_R (False);

Set_TL = False;
Filename = GVGetNamedString("BaseAdress","Error_Adress") +"_" + GetSymbolName + ".txt";
TL_String = "3,100.792940,100.792940,41572.3750000000,41624.2083333333,32768,1,0,False,False";

print (Filename);
TL_Price_S = StrtoNum(Splitstring(TL_String,2));
TL_Price_E = StrtoNum(Splitstring(TL_String,3));
TL_Time_S = StrtoNum(Splitstring(TL_String,4));
TL_Time_E = StrtoNum(Splitstring(TL_String,5));
TL_Color= StrtoNum(Splitstring(TL_String,6));
TL_Style = StrtoNum(Splitstring(TL_String,7));
TL_Size = StrtoNum(Splitstring(TL_String,8));

If splitstring(TL_string, 9) = "True" then TL_Ext_R = True else TL_Ext_R = False;
If splitstring(TL_string, 10) = "True" then TL_Ext_L = True else TL_Ext_L = False;

TL_NUM = TL_New_DT(TL_Time_S,TL_Price_S,TL_Time_E,TL_Price_E);

Set_TL = True;

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Trend Lince drawing: Amateur question

Postby TJ » 17 Dec 2013

Why are you using Intrabarpersist ?

What are you trying to achieve?

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: Trend Lince drawing: Amateur question

Postby arjfca » 17 Dec 2013

Why are you using Intrabarpersist ?

What are you trying to achieve?
Intrabarpersist: Tried with and without

The end goal is a function that will replicate trendline from workspace using same instrument but a different scale. A click on the upper right corner, capture the trend line and copied the info in a text file. On another workspace, a click on the lower right corner of the screen will replicate data from the trend line file of the same instrument

The captured function work fine.

The replicator function does not work yet. This questioning is for this section

At the moment, I'm working on a single line. The data string is copied from the captured trend line file that was created

Code: Select all

TL_String = "3,99.427120,99.427120,41572.3750000000,41624.2083333333,2124031,2,0,False,True";
This string contain
Price start
Price end
DateTime Start
DateTime End
Color
Size
Style
Extended to Left
Extended to Right

The Trend line is replicated with all the characteristic, stay one for a second then disappear

Martin

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: Trend Lince drawing: Amateur question

Postby arjfca » 17 Dec 2013

TJ,

The actual code is from a function. Meaning, The trend line is created within the function. Is it possible that the line is erase because the code does not go back in the function if the condition are not met? This function is only use when a shift + leftclick on the mouse is done on the lower right space of the screen.

Martin

Dru
Posts: 107
Joined: 28 Aug 2007
Has thanked: 4 times
Been thanked: 171 times

Re: Trend Lince drawing: Amateur question

Postby Dru » 18 Dec 2013

My code is drawing a trend line. After a very short time, the trend line disappear. How should I code to have it stay on screen
Insert in your code

Code: Select all

[recoverdrawings = false]

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: Trend Lince drawing: Amateur question

Postby arjfca » 18 Dec 2013

My code is drawing a trend line. After a very short time, the trend line disappear. How should I code to have it stay on screen
Insert in your code

Code: Select all

[recoverdrawings = false]
Hello Dru

I did add the [recoverdrawings = false] but problem remain
The trend line appear for few second then disappear.

Martin

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: Trend Lince drawing: Amateur question

Postby Andrew MultiCharts » 19 Dec 2013

Hello arjfca,

Please use Print keyword to output the start and end coordinates of the drawings. Most likely the are outside of the chart.

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: Trend Lince drawing: Amateur question

Postby arjfca » 19 Dec 2013

Hello arjfca,

Please use Print keyword to output the start and end coordinates of the drawings. Most likely the are outside of the chart.
Andrew, I think that I understood the problem.

MC need to refresh a draw trend line on every pass. My TL_Set... was done inside a conditional called function and MC is not going through the code on every pass. This cause the line to be erase soon after the creation.

MC 9.0 should have some code to allow to draw lines that will act like a manually draw trend line. Meaning, not attached to an indicator. Killing the indicator should not erase the lines, drawing them inside a function should also be OK

Martin

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: Trend Lince drawing: Amateur question

Postby Andrew MultiCharts » 19 Dec 2013

MC 9.0 should have some code to allow to draw lines that will act like a manually draw trend line. Meaning, not attached to an indicator. Killing the indicator should not erase the lines, drawing them inside a function should also be OK
Martin, please leave us such feature request.


Return to “MultiCharts”