Creating or modifying trendline cause MC to hang

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

Creating or modifying trendline cause MC to hang

Postby arjfca » 22 Aug 2011

Hello

First time that I play with trendline code. My goal is to found and modify and if not found create a trendline to display a proposed entry and stop loss.

First, I want to know if a trendline with 2 characteristic do exist
I want to have 4 combinaison to descrimate them
A)Green for Long entry
B)Red for Short entry
c) long Dot "- - - - -": for entry
d) Short dot for Stop loss: For stop loss

For the existence of a long orders price parameters, the following function will look for:
TL_Getcolor(TlNum) = 65280 ( green)
TL_GetStyle(TlNum) = 2

Code: Select all

Input:
TLColor (NumericSimple),
TLStyle (NumericSimple);

var:
TLNum (0),
TLFound (False);

TLNum = 1;
while (tlnum <> -2) or (tlfound = false) or (tlnum < 100) begin
print(TlNum);
If Tl_Getcolor(TlNum) = TLColor and TL_GetStyle(TLNum) = TLStyle then TLFound = True;
Print (TL_Getcolor(tlNum):0:0, " " , tlnum:0:0);
TLnum=TLNum + 1;
end;
If tlnum = 100 then tlnum = 0;
TlExist = Tlnum;
Any help appreciated
Martin

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

Re: Creating or modifying trendline cause MC to hang

Postby TJ » 22 Aug 2011

If you want to do trendline trading,
have you looked at this code?

Trendline Trader
http://www.tradersxchange.com/viewtopic.php?f=31&t=673

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: Creating or modifying trendline cause MC to hang

Postby Dave Masalov » 25 Aug 2011

arjfca,

To search the trendlines it is better to use functions tl_getfirst, tl_getnext: you can go through all the trendlines on the current chart.


Return to “MultiCharts”