Hi,
Wonder how you'd deal with multiple positions of the same instrument in EasyLanguage.
Let's say, you go both long and short on the same instrument with buy("EL") and sellshort("ES"), no problem with that because "buy" and "sellshort" take a string as the entry name so they could be differentiated.
Now you are both "long" AND "short" on the same instrument.
When you say "marketposition", does it return 1 (long), -1(short), or 0(flat)?....none of the 3 would be correct.
The problem here is, I'd like to be able to treat the different positions differently by quoting their "names". "marketposition" takes a numeric number as "number of positions ago" as "marketposition(NUM)", assuming that only one position, either long or short is allowed at one moment on the same instrument, which would not be the case in real world trading.
Similarly, what happened if you say "setstoploss(500)" and "setdollartrailing(500)" when you are both "long" and "short" at one moment on the same instrument, which position would be closed if the condition meets?
Thanks.
Dealing with multiple positions of the same instrument in EL
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Dealing with multiple positions of the same instrument i
You can start here:Hi,
Wonder how you'd deal with multiple positions of the same instrument in EasyLanguage.
Let's say, you go both long and short on the same instrument with buy("EL") and sellshort("ES"), no problem with that because "buy" and "sellshort" take a string as the entry name so they could be differentiated.
Now you are both "long" AND "short" on the same instrument.
When you say "marketposition", does it return 1 (long), -1(short), or 0(flat)?....none of the 3 would be correct.
The problem here is, I'd like to be able to treat the different positions differently by quoting their "names". "marketposition" takes a numeric number as "number of positions ago" as "marketposition(NUM)", assuming that only one position, either long or short is allowed at one moment on the same instrument, which would not be the case in real world trading.
Similarly, what happened if you say "setstoploss(500)" and "setdollartrailing(500)" when you are both "long" and "short" at one moment on the same instrument, which position would be closed if the condition meets?
Thanks.
[FAQ] Autotrade / Backtest / Optimization
viewtopic.php?f=16&t=10811
Most of your questions have already been answered in the wiki:
(Just use the search box with your keywords)
https://www.multicharts.com/trading-sof ... /Main_Page
Re: Dealing with multiple positions of the same instrument i
TJ,
Would you kindly be more specific? which part in the wiki that these specific issues are addressed?
I read thru the EL manuals and EL Functions and Reserved Words and wasn't able to find the answer.
The online wiki contains pretty much the same material as the EL manual I read, for example, "marketposition":
https://www.multicharts.com/trading-sof ... etPosition
Nothing new there, and my specific question is NOT addressed at all.
In addition, the "current position" concept introduced in EL is confusing, what if you have multiple positions at one time that all are "current"?
-k
Would you kindly be more specific? which part in the wiki that these specific issues are addressed?
I read thru the EL manuals and EL Functions and Reserved Words and wasn't able to find the answer.
The online wiki contains pretty much the same material as the EL manual I read, for example, "marketposition":
https://www.multicharts.com/trading-sof ... etPosition
Nothing new there, and my specific question is NOT addressed at all.
In addition, the "current position" concept introduced in EL is confusing, what if you have multiple positions at one time that all are "current"?
-k
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Dealing with multiple positions of the same instrument i
What would you like to know about MarketPosition?TJ,
Would you kindly be more specific? which part in the wiki that these specific issues are addressed?
I read thru the EL manuals and EL Functions and Reserved Words and wasn't able to find the answer.
The online wiki contains pretty much the same material as the EL manual I read, for example, "marketposition":
https://www.multicharts.com/trading-sof ... etPosition
Nothing new there, and my specific question is NOT addressed at all.
In addition, the "current position" concept introduced in EL is confusing, what if you have multiple positions at one time that all are "current"?
-k
Re: Dealing with multiple positions of the same instrument i
My question is, is it possible for functions such as "marketposition", "setstoploss", "setdollartrailing" etc to take an input string argument for different outstanding open positions (in the same or opposite directions) like:
marketposition("position#1");
marketposition("position#2");
....
setstoploss("position#1", 500);
setstoploss("position#2", 300);
......
setdollartrailing("position#1", 500);
setdollartrailing("position#2", 300);
......
thanks,
-k
marketposition("position#1");
marketposition("position#2");
....
setstoploss("position#1", 500);
setstoploss("position#2", 300);
......
setdollartrailing("position#1", 500);
setdollartrailing("position#2", 300);
......
thanks,
-k
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Dealing with multiple positions of the same instrument i
The description of the keyword is very specific -- you can only have one of the three scenario with a strategy.My question is, is it possible for functions such as "marketposition", "setstoploss", "setdollartrailing" etc to take an input string argument for different outstanding open positions (in the same or opposite directions) like:
marketposition("position#1");
marketposition("position#2");
....
setstoploss("position#1", 500);
setstoploss("position#2", 300);
......
setdollartrailing("position#1", 500);
setdollartrailing("position#2", 300);
......
thanks,
-k
ie.
1 indicates a long position,
-1 indicates a short position, and
0 is returned only if the current position is specified and indicates that the current position is flat.
You cannot have a long and a short position of the same instrument at the same broker with the same account at the same time.
Re: Dealing with multiple positions of the same instrument i
This is sad, it'd be helpful otherwise.
You cannot have a long and a short position of the same instrument at the same broker with the same account at the same time.
How about multiple positions in the same direction then, like in scaling-in and scaling-out, let's say I have two outstanding open longs, and I'd like to use "setstoploss" and "setdollartrailing" to treat the two longs differently, anyway on how to do that?
thanks,
-k
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Dealing with multiple positions of the same instrument i
This is sad, it'd be helpful otherwise.
You cannot have a long and a short position of the same instrument at the same broker with the same account at the same time.
Holding a long and a short at the same time is called a 'wash trade', which is illegal even if you use multiple accounts.
For example, it is in violation of CME's trading rules:
Rule 534 (“Wash Trades Prohibited”)
No person shall place or accept buy and sell orders in the same product and expiration month, and, for a put or call option, the same strike price, where the person knows or reasonably should know that the purpose of the orders is to avoid taking a bona fide market position exposed to market risk (transactions commonly known or referred to as wash trades or wash sales). Buy and sell orders for different accounts with common beneficial ownership that are entered with the intent to negate market risk or price competition shall also be deemed to violate the prohibition on wash trades. Additionally, no person shall knowingly execute or accommodate the execution of such orders by direct or indirect means.
Source.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Dealing with multiple positions of the same instrument i
setstoploss and setdollartrailing are Global orders....
How about multiple positions in the same direction then, like in scaling-in and scaling-out, let's say I have two outstanding open longs, and I'd like to use "setstoploss" and "setdollartrailing" to treat the two longs differently, anyway on how to do that?
thanks,
-k
see post #5
viewtopic.php?f=16&t=10811
If you wish to manage your orders individually, you have to code the step-by-step logic yourself.
There is no one-size-fits-all keyword that can fulfill all the possibilities.
Re: Dealing with multiple positions of the same instrument i
Very informative, thanks.
Holding a long and a short at the same time is called a 'wash trade', which is illegal even if you use multiple accounts.
For example, it is in violation of CME's trading rules:
What if you have two different strategies from two accounts but applied on the same instrument, one decides to go long, the other decides to go short?
Re: Dealing with multiple positions of the same instrument i
I guess this is the dead-end and you'd have to roll your own dough ?setstoploss and setdollartrailing are Global orders.
see post #5
viewtopic.php?f=16&t=10811
If you wish to manage your orders individually, you have to code the step-by-step logic yourself.
There is no one-size-fits-all keyword that can fulfill all the possibilities.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Dealing with multiple positions of the same instrument i
If they are applied to the same account, your broker will net them out.Very informative, thanks.
Holding a long and a short at the same time is called a 'wash trade', which is illegal even if you use multiple accounts.
For example, it is in violation of CME's trading rules:
What if you have two different strategies from two accounts but applied on the same instrument, one decides to go long, the other decides to go short?
Homework: read up on Comparison of Synchronous and Asynchronous Mode
If they are applied to different accounts (ie on different charts), MultiCharts won't know and don't care.
For legal standings, please read answer in my previous post (#8).
If you need to know more scenario on wash trade, pls read the Q&A in CME's ADVISORY NOTICE. The link is in post #8.
Learning auto-trade is like studying for your PhD, there is much to learn, and it won't happen over the weekend.
Please start here:
viewtopic.php?f=16&t=10811
please look for the article:
Trading from Multiple Charts on One Instrument
Re: Dealing with multiple positions of the same instrument i
TJ,Please start here:
viewtopic.php?f=16&t=10811
please look for the article:
Trading from Multiple Charts on One Instrument
The technical issues were raised here after they've been fully investigated and (re)searched in the EL language manual/guide, i.e. the wiki stuff, and not addressed, and none has anything to do with "trading from multiple charts on one instrument".
Thanks for the legal issue brought up here, I guess that implicitly explains the way MC is implemented as it is.
-k
Re: Dealing with multiple positions of the same instrument i
If I understand correctly, a wash trade is a simultaneous buy a sell. What about if on Monday I go long MSFT and on Thursday I go short and I want to keep both trades in different accounts? Is that illegal? Potentially I can profit from both trades depending on price changes.
Re: Dealing with multiple positions of the same instrument i
or, for day-traders, let's say, one of your strategies went long in the morning, another strategy went short on the same instrument in the afternoon because the market changed (but your morning long position was still open by then), assuming the two strategies were from different accounts. Is that legal or not?If I understand correctly, a wash trade is a simultaneous buy a sell. What about if on Monday I go long MSFT and on Thursday I go short and I want to keep both trades in different accounts? Is that illegal? Potentially I can profit from both trades depending on price changes.
I know people apply different strategies on same instrument based on different logics, if entering a trade on the same instrument from the opposite direction at different time of the day were illegal, how could they manage to do that then?
Re: Dealing with multiple positions of the same instrument i
fromIf I understand correctly, a wash trade is a simultaneous buy a sell. What about if on Monday I go long MSFT and on Thursday I go short and I want to keep both trades in different accounts? Is that illegal? Potentially I can profit from both trades depending on price changes.
http://www.cmegroup.com/rulebook/files/ ... 0913-5.pdf
found this
CME Group RA0913-5
November 3, 2009
Page 4-5 of 5
Q13- Is it considered a violation of Rule 534 if orders initiated for accounts with common beneficial ownership by one or more automated trading systems match against each other?
A13- If different automated trading algorithms for the same trading entity are operating in the same instrument and potentially may trade with one another, each such algorithm should be identified with a unique operator ID (also called a Tag 50 ID) tied to the individual or team of individuals that operate the system/algorithms. While it is not prohibited to run potentially conflicting algorithms simultaneously, if such trades cause price or volume aberrations, or occur frequently, the trading may be subject to particular scrutiny and may be deemed to violate Rule 534.
Market participants
are responsible for monitoring their automated trading systems and for employing trading algorithms that minimize the potential for the execution of transactions which are not exposed to market risk.
Re: Dealing with multiple positions of the same instrument i
Thanks but the definition is too vague. I wish someone could give a better answer to my question above.from
http://www.cmegroup.com/rulebook/files/ ... 0913-5.pdf
found this
CME Group RA0913-5
November 3, 2009
Page 4-5 of 5
Q13- Is it considered a violation of Rule 534 if orders initiated for accounts with common beneficial ownership by one or more automated trading systems match against each other?
A13- If different automated trading algorithms for the same trading entity are operating in the same instrument and potentially may trade with one another, each such algorithm should be identified with a unique operator ID (also called a Tag 50 ID) tied to the individual or team of individuals that operate the system/algorithms. While it is not prohibited to run potentially conflicting algorithms simultaneously, if such trades cause price or volume aberrations, or occur frequently, the trading may be subject to particular scrutiny and may be deemed to violate Rule 534.
Market participants
are responsible for monitoring their automated trading systems and for employing trading algorithms that minimize the potential for the execution of transactions which are not exposed to market risk.
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Dealing with multiple positions of the same instrument i
I'd like to add: do your more homework regarding trading. Perhaps I'm to tired, but what's the point of opening a short and long position simultaneously? That would give you a combined delta of 0, since any profit on one side will be offset by an equally large loss on the other side. Since you'll have to pay commissions and slippage, this seems to be a loser strategy from the onset.(...)
Homework: read up on Comparison of Synchronous and Asynchronous Mode
(...)
And while you could sell the long for a profit if the prices moves a little up, and then wait for it to come down to sell the short with a profit, you could also do this in two trades, which would lower your risk management (no need to hope for a reversal to close the other side profitable), less legal risk (see above in this thread) and less broker/technology risk (no need for two accounts and the communication between these).
Of course it's vague, it's a juridical and technical document from a big company. What would be a 'better answer' for you? The legality and technicalities have already been answered in this thread. Why not, for futures, contact the CME directly (see here)?Thanks but the definition is too vague. I wish someone could give a better answer to my question above.