Need code help

Questions about MultiCharts and user contributed studies.
StefanoSF
Posts: 116
Joined: 19 Aug 2012
Location: San Francisco
Has thanked: 23 times
Been thanked: 30 times
Contact:

Need code help

Postby StefanoSF » 07 Nov 2014

Hi,

I want to combine two strategies into one using "Entry("EntryName") to disquisition the specific entries and then attach a Limit exit. I know this code is way wrong but is there a simple way to associate a specific Entry to a Limit Exit Order?

Input:
TP(50); //Profit target

if t=900 then
Buy("Entry1") next bar Market;
if t=1000 then
Buy("Entry2") next bar Market;

SetStopShare;

If Entry("Entry1")
then SetProfitTarget(TP);

If Entry("Entry2")
then SetProfitTarget(TP);

Xyzzy
Posts: 162
Joined: 19 Mar 2011
Has thanked: 43 times
Been thanked: 79 times

Re: Need code help

Postby Xyzzy » 07 Nov 2014

I don't believe you can do this through the SetProfitTarget command. However, you can do this using sell limit orders using the "sell from entry()" syntax that's shown here:

http://www.multicharts.com/trading-soft ... x.php/Sell

For your example, just change the last two lines to:

Code: Select all

Sell from Entry ("Entry1") at Value1 limit;
Sell from Entry ("Entry2") at Value2 limit;
Where Value1 and Value2 are your limit prices.


Return to “MultiCharts”