Hallo forum members,
I am new to this forum and first would like to say hallo to everyone! I am quite new to MultiCharts programming, but I have some few years of EasyLanguage programming using TS that I've used some years ago.
I have the following question: Is there a way to make use of the subsequent bar's open price in a condition within MultiCharts?
Thanks for your comments.
Best regards, K.B.
Use of "Open of Next Bar" in Trading-Signals [SOLVED]
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Use of "Open of Next Bar" in Trading-Signals
>>subsequent bar's open price
Straight answer -- NO
We perform our evaluation based on existing data.
If you want to include an open price in your logic, you have to first wait for it to happen, then do your evaluation.
Straight answer -- NO
We perform our evaluation based on existing data.
If you want to include an open price in your logic, you have to first wait for it to happen, then do your evaluation.
Re: Use of "Open of Next Bar" in Trading-Signals
Thanks for your answer. So I'll rewrite some code ...
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Use of "Open of Next Bar" in Trading-Signals
You can use the `Symbol_Open` variable to get the open price of the next bar. See https://www.multicharts.com/trading-sof ... ymbol_Open for more.
This does require that your script doesn't run on the last bar of the chart, or else `Symbol_Open` triggers an error. (You can check for that possibility by comparing the current bar number with the total number of bars on the chart.)
Note that `Symbol_Open` doesn't make the strategy calculate in the context of the next bar's open. That feature is in MultiCharts .NET, but not in regular MultiCharts as far as I can tell.
So when you use `Symbol_Open`, the strategy still calculates on the close of price bars, but with the benefit of knowing where the next bar's open is going to be.
This does require that your script doesn't run on the last bar of the chart, or else `Symbol_Open` triggers an error. (You can check for that possibility by comparing the current bar number with the total number of bars on the chart.)
Note that `Symbol_Open` doesn't make the strategy calculate in the context of the next bar's open. That feature is in MultiCharts .NET, but not in regular MultiCharts as far as I can tell.
So when you use `Symbol_Open`, the strategy still calculates on the close of price bars, but with the benefit of knowing where the next bar's open is going to be.
Re: Use of "Open of Next Bar" in Trading-Signals [SOLVED]
Thanks JoshM for your excellent hint. The "Symbol_Open" variable contains the needed information, in my case!
I added the following lines at the top of the signal's code to be able to use "NxtOpen:
I added the following lines at the top of the signal's code to be able to use "NxtOpen:
Code: Select all
vars: NxtOpen (0);
NxtOpen=Close;
if barnumber + MaxBarsBack < Symbol_Length then begin
NxtOpen = symbol_open[-1];
end;