Problem with the Custom 1 Line indicator

Questions about MultiCharts and user contributed studies.
Leo
Posts: 89
Joined: 23 Sep 2015
Has thanked: 8 times
Been thanked: 4 times

Problem with the Custom 1 Line indicator

Postby Leo » 30 May 2022

Hello all,

I use the Custom 1 Line indicator to show whether a given system is flat or, if on market, how many contracts have been bought/sold.
To do this, I've modified the formula as attached.
The problem is that sometimes, the indicator shows that the system is flat, while that's not true, and I have to turn off it by clicking Status and turn on it again to read the correct position of the system.

Any suggestion?
Thanks in advance
Attachments
2022-05-30_15-54-22.png
(7.94 KiB) Not downloaded yet

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

Re: Problem with the Custom 1 Line indicator

Postby TJ » 30 May 2022

My guess is, that this is a coding error.

User avatar
Svetlana MultiCharts
Posts: 645
Joined: 19 Oct 2017
Has thanked: 3 times
Been thanked: 163 times

Re: Problem with the Custom 1 Line indicator

Postby Svetlana MultiCharts » 02 Jun 2022

Hi Leo,

These keywords show the market position of a strategy on a chart, the value is not related to the broker profile. Please compare the indicator’s value on the latest bar with the latest trade in the Strategy Performance Report on the same chart. Do the values correspond?

Leo
Posts: 89
Joined: 23 Sep 2015
Has thanked: 8 times
Been thanked: 4 times

Re: Problem with the Custom 1 Line indicator

Postby Leo » 07 Jun 2022

Hello Svetlana,

no, sometimes they do not correspond. Please consider that I check a couple of times per day that the number of contracts from charts and the broker are aligned. As said, sometimes I notice that the custom 1 line indicator is not updated correctly, and shows 0 contracts whereas I am long or short with 1 or more contracts. By clicking on the Status button of the Custom 1 line indicator, it reload correctly showing the correct number of contracts

User avatar
Svetlana MultiCharts
Posts: 645
Joined: 19 Oct 2017
Has thanked: 3 times
Been thanked: 163 times

Re: Problem with the Custom 1 Line indicator

Postby Svetlana MultiCharts » 09 Jun 2022

If you want to get the broker position, please use i_MarketPosition_at_Broker keyword.
Configure your indicator in Format – Study – Format – Properties as shown in the picture.
indicator advanced.png
(7.2 KiB) Not downloaded yet

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: Problem with the Custom 1 Line indicator

Postby syswizard » 15 Jun 2022

Does this mean that one's code must distinguish between live trading and back testing ?
How to detect Live trading mode vs. Backtesting in Powerlanguage ?

User avatar
Svetlana MultiCharts
Posts: 645
Joined: 19 Oct 2017
Has thanked: 3 times
Been thanked: 163 times

Re: Problem with the Custom 1 Line indicator

Postby Svetlana MultiCharts » 16 Jun 2022

How to detect Live trading mode vs. Backtesting in Powerlanguage ?
Please refer to the help for GetAppInfo.
You may want to use:
GetAppInfo(aiRealTimeCalc)
GetAppInfo(aiStrategyAuto) – returns 0 for indicators, as they cannot trade.


Return to “MultiCharts”