Tying entries with its contracts

Questions about MultiCharts and user contributed studies.
kernel
Posts: 91
Joined: 19 Feb 2013
Has thanked: 21 times
Been thanked: 4 times

Tying entries with its contracts

Postby kernel » 20 Nov 2015

Hi,

Let's say, you have two long entries, LE1 and LE2, together they established an open position of 10 contracts total (some of the orders they placed may not be filled). Is there any way to know how many contracts were by LE1 and how many were by LE2 at any time?

In this case, "entryname" seems to reflect LE1 only, but not LE2.

thanks,

-kernel

kernel
Posts: 91
Joined: 19 Feb 2013
Has thanked: 21 times
Been thanked: 4 times

Re: Tying entries with its contracts

Postby kernel » 20 Nov 2015

Here's a code snippet from EL_essential book under "Tying Entry and Exit".
Problem is, assuming entry orders were placed not by market orders, or even by market orders in IOG code, it's possible not all 200 shares or 100 shares were filled on "next tick". In this case, you need to know how many are actually filled by each different entry to be able to partially sell some of them (scale-out) for each entry.

Code: Select all

Buy("My1stBuy") Next Bar 200 Shares at Market;
Buy("My2ndBuy") Next Bar 100 Shares at High Stop;
Sell("My1stSell") Next Bar From Entry ("My1stBuy") 100 shares at High Limit;
Sell("My2ndSell") Next Bar From Entry ("My2ndBuy") 50 shares at Low Stop;
if Time = 1500 then Sell next bar at Market;

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2942 times

Re: Tying entries with its contracts

Postby Henry MultiСharts » 15 Dec 2015

Hello kernel,

Please refer to PosTradeSize. Also check Trades vs Orders With PosTrade Keywords.


Return to “MultiCharts”