Multiple Positions + Multiple exit targets  [SOLVED]

Questions about MultiCharts and user contributed studies.
User avatar
hb7of9
Posts: 18
Joined: 23 Apr 2014
Has thanked: 9 times
Been thanked: 3 times

Multiple Positions + Multiple exit targets

Postby hb7of9 » 19 Oct 2023

I'm trying to have multiple positions, upto 50.

Each trade/position should have it's own stop loss and profit target.
For example example, 30% stop loss and 30% proift target.
All, the trades/positons, will have the same 30% profit/loss target for each indivdual trade

For example:

Trade_1
Entry Price $10, would have a $3 stop loss/proift target

Trade 2
Entry Pr ice $100, would have a $30 stop loss/profit taget

Code: Select all

if GO and (Close < Open) then begin Sell ("BuyOrder") MyShares shares next bar at Open; SetProfitTarget(10); //( Open - (Open * ProfTrgPerc) ); SetStopLoss(10) ; //( (Open * StopLossPerc) ); // Sell ("SellOrder") MyShares next bar at (Open * StopLossPerc) stop; // Sell ("TakeProfitOrder") MyShares next bar at (Close * ProfTrgPerc) limit; end;
I've tried a few diffent approaches but have not found a good soltion for this as yet, any ideas would be highly appreicated.

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

Re: Multiple Positions + Multiple exit targets  [SOLVED]

Postby TJ » 20 Oct 2023

SetProfitTarget and SetStopLoss are Global Exits. They are applied to the account instead of individual trades.

If you need to manage trades individually, you will need to code the management individually.

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

Re: Multiple Positions + Multiple exit targets

Postby TJ » 24 Oct 2023



Return to “MultiCharts”