How to emulate "ExitName"?

Questions about MultiCharts and user contributed studies.
2haerim
Posts: 502
Joined: 01 Sep 2006
Been thanked: 2 times

How to emulate "ExitName"?

Postby 2haerim » 25 Jan 2010

I have seen some language has "ExitName" reserved word.
It is used like, for example,

If marketposition <> 0 Then begin
Sell ("LX1") Next bar at EntryPrice+10 stop;
Sell ("LX2") Next bar at EntryPrice+20 stop;
BuyToCover ("SX1") Next bar at EntryPrice-10 stop;
BuyToCover ("SX2") Next bar at EntryPrice-20 stop;
End;

If marketposition=0 And marketposition(1)=1 And exitname(1)="LX1" Then
sellShort ("SE1") 5 contracts next bar at market;

If marketposition=0 And marketposition(1)=1 And exitname(1)="LX2" Then
sellShort ("SE2") 10 contracts next bar at market;

If marketposition=0 And marketposition(1)=-1 And exitname(1)="SX1" Then
Buy("LE1") 5 contracts next bar at market;

If marketposition=0 And marketposition(1)=-1 And exitname(1)="SX2" Then
Buy("LE2") 10 contracts next bar at market;

Unfortunately, EasyLanguage does not have ExitName or like.

Can anyone tell me how to emulate "ExitName" using EasyLanguage?

Thanks.

User avatar
Bruce DeVault
Posts: 438
Joined: 19 Jan 2010
Location: Washington DC
Been thanked: 2 times
Contact:

Postby Bruce DeVault » 25 Jan 2010

What language are you referring to?

2haerim
Posts: 502
Joined: 01 Sep 2006
Been thanked: 2 times

Postby 2haerim » 25 Jan 2010

I am talking about some EL-derived language to mention a few, but you would not know them. They are not well known ones.

Anyway, I just want to know how to implement the concept of "ExitName".

With such feature, it would be possible to control the reentry.

User avatar
Anastassia
Posts: 179
Joined: 18 Jan 2010
Been thanked: 4 times

Postby Anastassia » 25 Jan 2010

How to emulate "ExitName"?
Dear 2haerim

It is not possible to emulate "ExitName" in MultiCharts. PowerLanguage does not have "ExitName" as a reserved word and there is no other word to replace it.

janus
Posts: 778
Joined: 25 May 2009
Has thanked: 45 times
Been thanked: 93 times

Re:

Postby janus » 08 Aug 2010

Exitname now appears to be a reserved word in 6.0. What does it do?

2haerim
Posts: 502
Joined: 01 Sep 2006
Been thanked: 2 times

Re: How to emulate "ExitName"?

Postby 2haerim » 08 Aug 2010

This is really a long-waited feature.

TSS please confirm this is officially supported built-in function and provide a complete documentation.

User avatar
Anastassia
Posts: 179
Joined: 18 Jan 2010
Been thanked: 4 times

Re: How to emulate "ExitName"?

Postby Anastassia » 09 Aug 2010

Hi Guys,

Exitname/Entryname keywords are officially supported in MultiCharts release of 6.0.
Entryname/exitname are available for signals only. Entryname allows to get name of orders that open last position and Exitname is used to get name of orders that close last position.

Thank you

janus
Posts: 778
Joined: 25 May 2009
Has thanked: 45 times
Been thanked: 93 times

Re: How to emulate "ExitName"?

Postby janus » 09 Aug 2010

Thanks Anastassia. Entryname appears to work but Exitname appears to print blank always. However, the entry and exit signal names appears correctly on the chart. The following signal study demonstrate this:

Code: Select all

[IntrabarOrderGeneration = True]

variables:
intrabarpersist counter(0);

if LastBarOnChart_s then begin
print ("entryname:", entryname);
print ("exitname:", exitname);
once buy ("LONG") 2 contracts next bar at market; // once off buy order on next tick update
counter = counter + 1;
print (counter);
if counter = 5 then sell ("COVER") all contracts next bar at market; // cover all after a few ticks
end;

User avatar
Anastassia
Posts: 179
Joined: 18 Jan 2010
Been thanked: 4 times

Re: How to emulate "ExitName"?

Postby Anastassia » 24 Aug 2010

Hi Janus,
Entryname appears to work but Exitname appears to print blank always.

ExitName(PosBack)

Where: PosBack - a numerical expression, specifying the position:

0 - open position;
1 - one position back (the last position closed);
2 - two positions back, etc.

If PosBack is not specified, a value for the open position will be returned.
Since you use Exitname without parameters in your script, the exit name for open position will be returned (If PosBack is not specified, a value for the open position will be returned).
So it will "print blank" because the position is still opened (there hasn't been exit yet).
Most likely you wanted exit name for the last closed position (the last position closed).
If so, use ExitName(1) instead of ExitName


Thank you


Return to “MultiCharts”