"This" reserved word
-
- Posts: 60
- Joined: 28 Dec 2007
- Has thanked: 9 times
- Been thanked: 1 time
"This" reserved word
Most non-intrabar signals are executed next bar, usually on open. MC EL has a "This" reserved word. Would a signal using "this bar" execute during the current bar?
Stork
Stork
- TJ
- Posts: 7744
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: "This" reserved word
You need to look up IntraBarOrderGeneration.Most non-intrabar signals are executed next bar, usually on open. MC EL has a "This" reserved word. Would a signal using "this bar" execute during the current bar?
Stork
https://www.multicharts.com/trading-sof ... /Main_Page
- TJ
- Posts: 7744
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: "This" reserved word
also look up:
EasyLanguage Essentials Programmers Guide
Creating Trading Strategies
Strategy Order Syntax .... pg 80
EasyLanguage Essentials Programmers Guide
Creating Trading Strategies
Strategy Order Syntax .... pg 80
Re: "This" reserved word
If you are looking for a way to execute orders at the broker in the current bar, or at least at the end of the current bar, then I'm afraid using "this" won't help. It has been a sore point for me for some time. However, the market is liquid enough most of the time to let one get around this by turning on intrabar order generation and using the standard "next". Unfortunately, during quiet periods this provided no value at all until fairly recently when MC came to the rescue and provided a means to force a study to calculate using RecalcLastBarAfter. That way you can use "next" with IOG turned on to transmit orders to the broker for execution no later than in a second or two. Still not ideal but good enough for just about all except the high frequency traders.Most non-intrabar signals are executed next bar, usually on open. MC EL has a "This" reserved word. Would a signal using "this bar" execute during the current bar?
Stork
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: "This" reserved word
That is possible to execute during this bar with the help of "This" code word.Most non-intrabar signals are executed next bar, usually on open. MC EL has a "This" reserved word. Would a signal using "this bar" execute during the current bar?
Stork
Re: "This" reserved word
Does this include market orders being sent to the broker? I thought "this bar" was generally used for historical backtesting purposes only, and it will not generate a market on close order in real-time to the broker. Has this changed? If it has that's good news.That is possible to execute during this bar with the help of "This" code word.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: "This" reserved word
That is possible to send a market order on the close of the current bar using the statementDoes this include market orders being sent to the broker? I thought "this bar" was generally used for historical backtesting purposes only, and it will not generate a market on close order in real-time to the broker. Has this changed? If it has that's good news.That is possible to execute during this bar with the help of "This" code word.
Code: Select all
buy this bar on close;
Re: "This" reserved word
Well, it didn't work! I used:That is possible to send a market order on the close of the current bar using the statementCode: Select all
buy this bar on close;
buy 2 contracts this bar on close
and nothing happened.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: "This" reserved word
I have checked it on MC 7.4 release and MC 8.0 beta 2. It works as expected in these versions.Well, it didn't work! I used:That is possible to send a market order on the close of the current bar using the statementCode: Select all
buy this bar on close;
buy 2 contracts this bar on close
and nothing happened.
Please let me know what exact version you are referring to.
Re: "This" reserved word
Yes it now works but only if the order is sent when barstatus = 2. In other words, even with IOG turned on, "this" orders are not sent intrabar. The other order with "next" works intrabar with IOG turned on. Now we have the added confusion of having to remember how to submit and manage in our code buy/sellshort orders depending on whether we use "next" or "this". I'll stick to using "next" as I need my orders to be executed intrabar.I have checked it on MC 7.4 release and MC 8.0 beta 2. It works as expected in these versions.
Please let me know what exact version you are referring to.
I must say I'm wasting a lot of my time testing orders when I should be trading. The order commands IMHO are a mess. Coding would be a lot simpler and easier if we had additional orders like
buy 2 contracts next tick at market
and avoid the confusion with "bar" when it can mean either tick or completed bar depending on the order type with IOG turned on. This way we can have intrabar orders and non-intrabar orders in the same study without the need to specify "[IntrabarOrderGeneration = True]". The code would be far easier to read as well.
That's speaking as a professional trader with over 30 years of experience in futures. I can't imagine how a novice can handle such issues. It's a mine field for sure.
I still think "this" didn't work with the broker in past releases but I may be wrong. The document that I have labelled "EasyLanguage Essentials Programmers Guide" supports the notion I may not be wrong as it explicitly states on page 80:
"this bar on Close: Market order on the close of this bar, generally used for historical backtesting
purposes only. This will not generate a market on close order."
Now if it has always been the case "this" does generate a market on close order when barstatus = 2 using MC as distinct from TS, then the documentation should have been updated a long time ago.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: "This" reserved word
Correct.Yes it now works but only if the order is sent when barstatus = 2.I have checked it on MC 7.4 release and MC 8.0 beta 2. It works as expected in these versions.
Please let me know what exact version you are referring to.
Code: Select all
Buy This Bar On Close;
Close of this bar=closing tick of this bar="barstatus=2"
-
- Posts: 60
- Joined: 28 Dec 2007
- Has thanked: 9 times
- Been thanked: 1 time
Re: "This" reserved word
The point I'm making is the term "bar" and "tick" are confusing. Orders using "next" with IOG turned on changes the term "bar" to mean "tick". For orders using "this" the term "bar" doesn't mean "tick". How a novice user of MC manages to avoid being confused is beyond me. All I'm suggesting is we have a clearer syntax to avoid this confusion in the first place, and make coding in PL so much more readable. Such a small change as I suggested in my previous post would make a huge and beneficial difference.Description from Help: Buy a user-set number of shares on close of this bar.Code: Select all
Buy This Bar On Close;
Close of this bar=closing tick of this bar="barstatus=2"
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: "This" reserved word
We would like to get more feedback from our users on this subject.The point I'm making is the term "bar" and "tick" are confusing. Orders using "next" with IOG turned on changes the term "bar" to mean "tick". For orders using "this" the term "bar" doesn't mean "tick". How a novice user of MC manages to avoid being confused is beyond me. All I'm suggesting is we have a clearer syntax to avoid this confusion in the first place, and make coding in PL so much more readable. Such a small change as I suggested in my previous post would make a huge and beneficial difference.Description from Help: Buy a user-set number of shares on close of this bar.Code: Select all
Buy This Bar On Close;
Close of this bar=closing tick of this bar="barstatus=2"
Please submit a feature request to the Project Management of our web site so other users can vote for it: https://www.multicharts.com/pm/
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: "This" reserved word
It works with point bars, the closing tick is determined by the opening tick of the next bar.Henri,
Does you method work when using range bars?
Stork
Re: "This" reserved word
I just wanted to bring this confusion to the attention of readers of this forum but now that you suggested it I will submit a PM even though I won't be using the keyword "this" at all and so it would not benefit me so much. I was just thinking of other users, especially novices.We would like to get more feedback from our users on this subject.
Please submit a feature request to the Project Management of our web site so other users can vote for it: https://www.multicharts.com/pm/
Re: "This" reserved word
Feature request submitted, please see https://www.multicharts.com/pm/viewissu ... _no=MC-903We would like to get more feedback from our users on this subject.
Please submit a feature request to the Project Management of our web site so other users can vote for it: https://www.multicharts.com/pm/
-
- Posts: 60
- Joined: 28 Dec 2007
- Has thanked: 9 times
- Been thanked: 1 time
Re: "This" reserved word
I am glad my "This" reserved word thread stimulated much needed discussion. Both Henry and Janus make important contributions.
I believe Janus's suggested fix for MC may be improved on even more simply. I suggest that the default state simply be IOG (or what ever MC chooses to call it). A switch to trade on next bar open should be made available to the user. This is essentially the opposite of what TS and MC currently use.
This default would allow instant trading without having the delay to the next bar to be the normal state. The trade would execute in whatever manner at specific times chosen by the programmer. This would allow the trade to rapidly execute, save time and minimize losses. It would simplify programming. It should resolve some of the current difficulties in back testing.
For those wishing to delay the trade until the opening of the next bar, a simple switch to that mode would be satisfactory.
Stork
I believe Janus's suggested fix for MC may be improved on even more simply. I suggest that the default state simply be IOG (or what ever MC chooses to call it). A switch to trade on next bar open should be made available to the user. This is essentially the opposite of what TS and MC currently use.
This default would allow instant trading without having the delay to the next bar to be the normal state. The trade would execute in whatever manner at specific times chosen by the programmer. This would allow the trade to rapidly execute, save time and minimize losses. It would simplify programming. It should resolve some of the current difficulties in back testing.
For those wishing to delay the trade until the opening of the next bar, a simple switch to that mode would be satisfactory.
Stork
Re: "This" reserved word
wall richard, I used to have exactly the same thoughts as you until I realised it would cause backward compatibility issues for those who do not want to trade intrabar, and lead to even more confusion. Besides, I doubt very much they would make such a drastic change to MC as you suggest. At least with my idea the way MC operates does not change at all with existing code but the choice is there for users to make the code look far less confusing.
-
- Posts: 60
- Joined: 28 Dec 2007
- Has thanked: 9 times
- Been thanked: 1 time
Re: "This" reserved word
Allowing the programmer to precisely program when the exact instant the trade needs to be executed is a major advance.
By allowing the "switch" to trade next bar open obviates the backward compatibility issue. It would still remain the same as it is now. Although backward compatibility, in this instance,remains important to some; it is a dinosaur relic of the past. And, the lag it always produces guarantees lost profits.
By defaulting to immediate intrabar execution, programming actually becomes less burdensome. This is especially true for newcomers. If they prefer the "switch" that's ok too. So, there is no backward compatibility at issue.
Finally, this minor programming change by MC will give them serious advantage versus TS, their major competitor. It's not unusual for MC to change to easier and more successful code.
Stork
By allowing the "switch" to trade next bar open obviates the backward compatibility issue. It would still remain the same as it is now. Although backward compatibility, in this instance,remains important to some; it is a dinosaur relic of the past. And, the lag it always produces guarantees lost profits.
By defaulting to immediate intrabar execution, programming actually becomes less burdensome. This is especially true for newcomers. If they prefer the "switch" that's ok too. So, there is no backward compatibility at issue.
Finally, this minor programming change by MC will give them serious advantage versus TS, their major competitor. It's not unusual for MC to change to easier and more successful code.
Stork
- TJ
- Posts: 7744
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: "This" reserved word
I don't think you understand the implications...
What do you say to the thousands of users who has been using this method for the past 20+ years with profitable results?
Tell them to re-write their codes?
What do you say to the thousands of users who has been using this method for the past 20+ years with profitable results?
Tell them to re-write their codes?
Re: "This" reserved word
Couldn't agree more. That's why my suggestion is so much better, and far less confusing to existing users. Sure, if TS and MC were invented today the other approach would have merit but that's not the case. Too late to change it now. Besides, there's really no need to make the switch since the user has the choice to trade intrabar or not very easily. Also, the other suggestion to switch the way operates is off topic. I'm only suggesting a small addition to the PL language to reduce confusion without altering how MC operates.I don't think you understand the implications...
What do you say to the thousands of users who has been using this method for the past 20+ years with profitable results?
Tell them to re-write their codes?
-
- Posts: 60
- Joined: 28 Dec 2007
- Has thanked: 9 times
- Been thanked: 1 time
Re: "This" reserved word
So, TJ and Janus, do you both agree that trading on the next open introduces lag and decreases any profits as opposed to realtime immediate trading within the current bar?
Stork
Stork
- TJ
- Posts: 7744
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: "This" reserved word
No, that's NOT what I said.So, TJ and Janus, do you both agree that trading on the next open introduces lag and decreases any profits as opposed to realtime immediate trading within the current bar?
Stork
Please go back to read the posts again.
You can also propose an answer to my question before diverging.
Re: "This" reserved word
wall richard, you are confusing trading style with program language syntax. If a trader doesn't realise the difference between intrabar trading and end of bar trading then perhaps that trader should find another line of work. All I'm suggesting is a small addition to the PL language to provide a way to write less confusing code. I'm certainly not sticking my neck out to suggest as you do to alter the behaviour of the trading platform such that it would require the modification of virtually all existing studies to work as expected. Also, you may find it surprising but there a lot of traders who never used intrabar, and never will, for a variety of reasons.
-
- Posts: 60
- Joined: 28 Dec 2007
- Has thanked: 9 times
- Been thanked: 1 time
Re: "This" reserved word
Good evening Gentlemen. First of all I started this thread with the chief goal of increasing profits for all on this board. So, I reserve the right to respectfully ask any question to achieve this goal. I repeat --
_____________________________________________________________________________
So, TJ and Janus, do you both agree that trading on the next open introduces lag and decreases any profits as opposed to realtime immediate trading within the current bar?
_____________________________________________________________________________
A non answer or obfuscation only demonstrates you do not know the answer or you are trying to convince the members of this board the question above is false. This is despite the fact that trading the open of the next bar is responsible for decreased profits or increased losses.
Thank You,
Stork
_____________________________________________________________________________
So, TJ and Janus, do you both agree that trading on the next open introduces lag and decreases any profits as opposed to realtime immediate trading within the current bar?
_____________________________________________________________________________
A non answer or obfuscation only demonstrates you do not know the answer or you are trying to convince the members of this board the question above is false. This is despite the fact that trading the open of the next bar is responsible for decreased profits or increased losses.
Thank You,
Stork
Re: "This" reserved word
If you are saying you have a system that generates a new buy or sell signal intrabar and you want to execute an order ASAP to avoid lags caused by end of bar processing, then you can do that now with MC. I'm sure you already knew that. I think we're talking past each other, and respectively any further discussion of the issue is pointless, unless of course you want to get back on topic and discuss what I had suggested to enhance the programming aspects of PL to reduce confusion for novice users in particular.