Help needed in modifying Bid and Ask Indicator

Questions about MultiCharts and user contributed studies.
Tresor
Posts: 1104
Joined: 29 Mar 2008
Has thanked: 12 times
Been thanked: 53 times

Help needed in modifying Bid and Ask Indicator

Postby Tresor » 15 Jul 2010

Hello,

Could someone please modify Bid and Ask Indicator to display only values of the current bar as presented in the screenshot?

Thanks
Attachments
Bid and Ask Indicator.png
(21.18 KiB) Downloaded 693 times

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

Postby TJ » 15 Jul 2010

Code: Select all

...
if barstatus = 2 then
begin
noplot(1);
noplot(2);
end;

Tresor
Posts: 1104
Joined: 29 Mar 2008
Has thanked: 12 times
Been thanked: 53 times

Postby Tresor » 15 Jul 2010

Code: Select all

variables:
var0( 0 ),
var1( 0 ) ;

if GetAppInfo( aiRealTimeCalc ) = 1 then
begin
var0 = InsideBid ;
var1 = InsideAsk ;
Plot1( var0, "Bid" ) ;
Plot2( var1, "Ask" ) ;
if barstatus = 2 then
begin
noplot(1);
noplot(2);
end ;
I get:
------ Compiled with error(s): ------
syntax error, unexpected 'end of file', expecting 'End'
errLine 17, errColumn 5, errLineEnd 17, errColumnEnd 5
causal study: (Function)
Attachments
compile error.png
(14.42 KiB) Downloaded 662 times

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

Postby TJ » 15 Jul 2010

if you indent the code so that
you can see a matching END for every BEGIN,
you will never run into this problem again.

Code: Select all

variables:
var0( 0 ),
var1( 0 ) ;

var0 = InsideBid ;
var1 = InsideAsk ;

if GetAppInfo( aiRealTimeCalc ) = 1 then
BEGIN

if barstatus = 2 then
BEGIN

noplot(1);
noplot(2);

END
else
BEGIN

Plot1( var0, "Bid" ) ;
Plot2( var1, "Ask" ) ;

END;

END;

Tresor
Posts: 1104
Joined: 29 Mar 2008
Has thanked: 12 times
Been thanked: 53 times

Postby Tresor » 15 Jul 2010

Helpful and educational :D

Thanks

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

Postby TJ » 15 Jul 2010

Helpful and educational :D

Thanks
you are welcome!


p.s. another tip:
Avoid using generic variable names.
Always create a meaningful name
so that you will know what the variable is for
when you revisit your code 3 months later.


Return to “MultiCharts”