Horizontal line from easylanguage  [SOLVED]

Questions about MultiCharts and user contributed studies.
mickatrade
Posts: 114
Joined: 12 Jul 2015
Has thanked: 20 times
Been thanked: 16 times

Horizontal line from easylanguage

Postby mickatrade » 27 Jan 2016

Hello,

I'm looking for a way to draw (from easylanguage) an horizontal line identical (with price text above the line) to those available in the chart analysis toolbox.
The only way i manage to have a similar (but not exactly the same) result was by the of use TL_NEW code.

Thx.

MJ

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

Re: Horizontal line from easylanguage

Postby TJ » 27 Jan 2016

Hello,

I'm looking for a way to draw (from easylanguage) an horizontal line identical (with price text above the line) to those available in the chart analysis toolbox.
The only way i manage to have a similar (but not exactly the same) result was by the of use TL_NEW code.

Thx.

MJ
What you said is a general concept.
You have to be a bit more descriptive on the specifics you want to do.
Different scenario pose different challenges, and different solutions.

Can you give an example?

Draw a mock up; this is the best way to visualize the end product.

mickatrade
Posts: 114
Joined: 12 Jul 2015
Has thanked: 20 times
Been thanked: 16 times

Re: Horizontal line from easylanguage

Postby mickatrade » 27 Jan 2016

As you know, it's not possible to share drawings between charts. I use supports and resistances in my trading method so i decided to create an indicator that is able to load from a csv file up to 10 horizontal levels for each intrument.
This indicator draws horizontal line with TL_New code but i can't see the price level text above each generated line (see attached file).

The structure of the csv file is like below :

Code: Select all

Titre,niv1,niv2,niv3,niv4,niv5,niv6,niv7,niv8,niv9,niv10
Wall Street 30,15350,15700,16000,16500,16700,16900,0,0,0,0
The code of the indicator is :

Code: Select all

inputs:
DataSrc("D:\dax.csv");

variables: niv1(0),niv2(0),niv3(0),niv4(0),niv5(0),niv6(0),niv7(0),niv8(0),niv9(0),niv10(0),
col1(0),col2(0),col3(0),col4(0),col5(0),col6(0),col7(0),col8(0),col9(0),col10(0),
status(""),
mavar(""),
MapSC_ID(MapSC.New),
RowMap(MapSN.New),
RowNum(0);


value1 = MapSC.ReadFile(MapSC_ID,DataSrc);
Value1 = MapSC.BuildRowMap(MapSC_ID, RowMap, "Titre");
RowNum = MapSN.Get(RowMap, GetSymbolName); // get the row for the asset
col1 = MapSC.Get(MapSC_ID, "niv1");
col2 = MapSC.Get(MapSC_ID, "niv2");
col3 = MapSC.Get(MapSC_ID, "niv3");
col4 = MapSC.Get(MapSC_ID, "niv4");
col5 = MapSC.Get(MapSC_ID, "niv5");
col6 = MapSC.Get(MapSC_ID, "niv6");
col7 = MapSC.Get(MapSC_ID, "niv7");
col8 = MapSC.Get(MapSC_ID, "niv8");
col9 = MapSC.Get(MapSC_ID, "niv9");
col10 = MapSC.Get(MapSC_ID, "niv10");


niv1 = ListN.Get(col1, RowNum);
niv2 = ListN.Get(col2, RowNum);
niv3 = ListN.Get(col3, RowNum);
niv4 = ListN.Get(col4, RowNum);
niv5 = ListN.Get(col5, RowNum);
niv6 = ListN.Get(col6, RowNum);
niv7 = ListN.Get(col7, RowNum);
niv8 = ListN.Get(col8, RowNum);
niv9 = ListN.Get(col9, RowNum);
niv10 = ListN.Get(col10, RowNum);


once begin
value1 = TL_new(date,time,niv1,date,time,niv1);
value11 = tl_setextright(value1,true);
value1 = TL_SetAlert(value1, 1);

value2 = TL_new(date,time,niv2,date,time,niv2);
value12 = tl_setextright(value2,true);
value2 = TL_SetAlert(value2, 1);

value3 = TL_new(date,time,niv3,date,time,niv3);
value13 = tl_setextright(value3,true);
value3 = TL_SetAlert(value3, 1);

value4 = TL_new(date,time,niv4,date,time,niv4);
value14 = tl_setextright(value4,true);
value4 = TL_SetAlert(value4, 1);

value5 = TL_new(date,time,niv5,date,time,niv5);
value15 = tl_setextright(value5,true);
value5 = TL_SetAlert(value5, 1);

value6 = TL_new(date,time,niv6,date,time,niv6);
value16 = tl_setextright(value6,true);
value6 = TL_SetAlert(value6, 1);

value7 = TL_new(date,time,niv7,date,time,niv7);
value17 = tl_setextright(value7,true);
value7 = TL_SetAlert(value7, 1);

value8 = TL_new(date,time,niv8,date,time,niv8);
value18 = tl_setextright(value8,true);
value8 = TL_SetAlert(value8, 1);

value9 = TL_new(date,time,niv9,date,time,niv9);
value19 = tl_setextright(value9,true);
value9 = TL_SetAlert(value9, 1);

value10 = TL_new(date,time,niv10,date,time,niv10);
value20 = tl_setextright(value10,true);
value10 = TL_SetAlert(value10, 1);


end;
Attachments
example.PNG
(50.64 KiB) Downloaded 889 times

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

Re: Horizontal line from easylanguage

Postby TJ » 28 Jan 2016

This thread would help:

ABC Floor Trader Pivots V3.xml
viewtopic.php?f=5&t=4025

mickatrade
Posts: 114
Joined: 12 Jul 2015
Has thanked: 20 times
Been thanked: 16 times

Re: Horizontal line from easylanguage  [SOLVED]

Postby mickatrade » 28 Jan 2016

Thank you for your support, it's ok now (see the picture)

the new code :

Code: Select all

inputs:
DataSrc("D:\dax.csv"),textpctPosition(5);

variables: niv1(0),niv2(0),niv3(0),niv4(0),niv5(0),niv6(0),niv7(0),niv8(0),niv9(0),niv10(0),
col1(0),col2(0),col3(0),col4(0),col5(0),col6(0),col7(0),col8(0),col9(0),col10(0),
txtID1(0),txtID2(0),txtID3(0),txtID4(0),txtID5(0),txtID6(0),txtID7(0),txtID8(0),txtID9(0),txtID10(0),
mydate(0),monrange(0),
MapSC_ID(MapSC.New),
RowMap(MapSN.New),
RowNum(0);


value1 = MapSC.ReadFile(MapSC_ID,DataSrc);
Value1 = MapSC.BuildRowMap(MapSC_ID, RowMap, "Titre");
RowNum = MapSN.Get(RowMap, GetSymbolName); // get the row for the asset
col1 = MapSC.Get(MapSC_ID, "niv1");
col2 = MapSC.Get(MapSC_ID, "niv2");
col3 = MapSC.Get(MapSC_ID, "niv3");
col4 = MapSC.Get(MapSC_ID, "niv4");
col5 = MapSC.Get(MapSC_ID, "niv5");
col6 = MapSC.Get(MapSC_ID, "niv6");
col7 = MapSC.Get(MapSC_ID, "niv7");
col8 = MapSC.Get(MapSC_ID, "niv8");
col9 = MapSC.Get(MapSC_ID, "niv9");
col10 = MapSC.Get(MapSC_ID, "niv10");


niv1 = ListN.Get(col1, RowNum);
niv2 = ListN.Get(col2, RowNum);
niv3 = ListN.Get(col3, RowNum);
niv4 = ListN.Get(col4, RowNum);
niv5 = ListN.Get(col5, RowNum);
niv6 = ListN.Get(col6, RowNum);
niv7 = ListN.Get(col7, RowNum);
niv8 = ListN.Get(col8, RowNum);
niv9 = ListN.Get(col9, RowNum);
niv10 = ListN.Get(col10, RowNum);


once begin
value1 = TL_new(date,time,niv1,date,time,niv1);
value11 = tl_setextright(value1,true);
txtID1 = Text_New(Date, Time, niv1, numtostr(niv1,1));
Value1 = Text_SetColor(txtID1 ,darkgray);



value2 = TL_new(date,time,niv2,date,time,niv2);
value12 = tl_setextright(value2,true);
txtID2 = Text_New(Date, Time, niv2, numtostr(niv2,1));
Value2 = Text_SetColor(txtID2 ,darkgray);


value3 = TL_new(date,time,niv3,date,time,niv3);
value13 = tl_setextright(value3,true);
txtID3 = Text_New(Date, Time, niv3, numtostr(niv3,1));
Value3 = Text_SetColor(txtID3 ,darkgray);


value4 = TL_new(date,time,niv4,date,time,niv4);
value14 = tl_setextright(value4,true);
txtID4 = Text_New(Date, Time, niv4, numtostr(niv4,1));
Value4 = Text_SetColor(txtID4 ,darkgray);


value5 = TL_new(date,time,niv5,date,time,niv5);
value15 = tl_setextright(value5,true);
txtID5 = Text_New(Date, Time, niv5, numtostr(niv5,1));
Value5 = Text_SetColor(txtID5 ,darkgray);


value6 = TL_new(date,time,niv6,date,time,niv6);
value16 = tl_setextright(value6,true);
txtID6 = Text_New(Date, Time, niv6, numtostr(niv6,1));
Value6 = Text_SetColor(txtID6 ,darkgray);


value7 = TL_new(date,time,niv7,date,time,niv7);
value17 = tl_setextright(value7,true);
txtID7 = Text_New(Date, Time, niv7, numtostr(niv7,1));
Value7 = Text_SetColor(txtID7 ,darkgray);


value8 = TL_new(date,time,niv8,date,time,niv8);
value18 = tl_setextright(value8,true);
txtID8 = Text_New(Date, Time, niv8, numtostr(niv8,1));
Value8 = Text_SetColor(txtID8 ,darkgray);

value9 = TL_new(date,time,niv9,date,time,niv9);
value19 = tl_setextright(value9,true);
txtID9 = Text_New(Date, Time, niv9, numtostr(niv9,1));
Value9 = Text_SetColor(txtID9 ,darkgray);


value10 = TL_new(date,time,niv10,date,time,niv10);
value20 = tl_setextright(value10,true);
txtID10 = Text_New(Date, Time, niv10, numtostr(niv10,1));
Value5 = Text_SetColor(txtID10 ,darkgray);



end;

mydate = getappinfo(aiLeftDispDateTime)+textpctPosition*(getappinfo(aiRightDispDateTime)-getappinfo(aiLeftDispDateTime))/100;
monrange = getappinfo(aihighestdispvalue)-getappinfo(ailowestdispvalue);

value1 = text_setlocation_DT(txtID1,mydate,niv1 + 0.015*monrange);
value2 = text_setlocation_DT(txtID2,mydate,niv2 + 0.015*monrange);
value3 = text_setlocation_DT(txtID3,mydate,niv3 + 0.015*monrange);
value4 = text_setlocation_DT(txtID4,mydate,niv4 + 0.015*monrange);
value5 = text_setlocation_DT(txtID5,mydate,niv5 + 0.015*monrange);
value6 = text_setlocation_DT(txtID6,mydate,niv6 + 0.015*monrange);
value7 = text_setlocation_DT(txtID7,mydate,niv7 + 0.015*monrange);
value8 = text_setlocation_DT(txtID8,mydate,niv8 + 0.015*monrange);
value9 = text_setlocation_DT(txtID9,mydate,niv9 + 0.015*monrange);
value10 = text_setlocation_DT(txtID10,mydate,niv10 + 0.015*monrange);

Attachments
ELhorizontalline.png
(45.46 KiB) Downloaded 890 times

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

Re: Horizontal line from easylanguage

Postby TJ » 28 Jan 2016

Thank you for your support, it's ok now (see the picture)

the new code :
::
Looking good.

Thanks for sharing the code.


Return to “MultiCharts”