Using Intrabarpersist with MaxList

Questions about MultiCharts and user contributed studies.
mefTrader
Posts: 141
Joined: 23 Jun 2011
Has thanked: 9 times
Been thanked: 7 times

Using Intrabarpersist with MaxList

Postby mefTrader » 20 Apr 2012

Hi,

Have the following piece of code

Code: Select all

[IntrabarOrderGeneration = True]

vars:  IntraBarPersist sell_level(0);


  sell_level = maxlist(sell_level, c[0]-sellstop);



Some print statements:

Line1: sell level[0] is 1.31530, c[0],1.31550
Line2: sell level[0] is 1.31528, c[0],1.31548
Line3: sell level[0] is 1.31527, c[0],1.31547
Line4: sell level[0] is 1.31526, c[0],1.31546


sell_level is declared as intrabarpersist so that if the current 'c[0]-sellstop' (sellstop=0.0002) is greater then sell_level updates otherwise it should hold the previous value.

Im seeing here that the variable does not seem to hold the max value but in effect is 'c[0]-sellstop' ?
Intrabarpersist does not seem to be working?

Tried this with intrabarpersist on/off similar behaviour?

User avatar
JoshM
Posts: 2075
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1523 times
Been thanked: 1480 times
Contact:

Re: Using Intrabarpersist with MaxList

Postby JoshM » 20 Apr 2012

mefTrader wrote:Im seeing here that the variable does not seem to hold the max value but in effect is 'c[0]-sellstop' ?
Intrabarpersist does not seem to be working?

Tried this with intrabarpersist on/off similar behaviour?

Judging from that output, it indeed doesn't seem to be working. Which version are you using?

I couldn't replicate it here (MC 7.4 Build 4906):

Code: Select all

20-04_13:11:39  Sell_Level:  1378.7500 Close[0]-SellStop: 1378.7500 Close[0]: 1379.0000
20-04_13:11:46  Sell_Level:  1378.7500 Close[0]-SellStop: 1378.5000 Close[0]: 1378.7500
20-04_13:11:46  Sell_Level:  1378.7500 Close[0]-SellStop: 1378.5000 Close[0]: 1378.7500
20-04_13:11:47  Sell_Level:  1378.7500 Close[0]-SellStop: 1378.5000 Close[0]: 1378.7500
20-04_13:11:47  Sell_Level:  1378.7500 Close[0]-SellStop: 1378.5000 Close[0]: 1378.7500
20-04_13:11:47  Sell_Level:  1378.7500 Close[0]-SellStop: 1378.2500 Close[0]: 1378.5000
20-04_13:11:47  Sell_Level:  1378.7500 Close[0]-SellStop: 1378.5000 Close[0]: 1378.7500
20-04_13:12:01  Sell_Level:  1378.7500 Close[0]-SellStop: 1378.2500 Close[0]: 1378.5000
20-04_13:12:06  Sell_Level:  1378.7500 Close[0]-SellStop: 1378.5000 Close[0]: 1378.7500
20-04_13:12:12  Sell_Level:  1378.7500 Close[0]-SellStop: 1378.5000 Close[0]: 1378.7500
20-04_13:12:12  Sell_Level:  1378.7500 Close[0]-SellStop: 1378.5000 Close[0]: 1378.7500
20-04_13:12:16  Sell_Level:  1378.7500 Close[0]-SellStop: 1378.5000 Close[0]: 1378.7500


Which looks correct to me, since Sell_Level remains the same Max value of the 'Close[0]-SellStop'.

Code: Select all

[IntraBarOrderGeneration = True]

Inputs:
   SellStop(0.25);
   
Variables:
   IntraBarPersist Sell_Level(0);
   
if (LastBarOnChart_s = True) then begin

   Sell_Level = MaxList(Sell_Level, Close[0] - SellStop);
   
   Print(TimeNow, "Sell_Level: ", NumToStr2(Sell_Level), "Close[0]-SellStop:", NumToStr2(Close[0] - SellStop),
      "Close[0]:", NumToStr2(Close[0]));
end;

mefTrader
Posts: 141
Joined: 23 Jun 2011
Has thanked: 9 times
Been thanked: 7 times

Re: Using Intrabarpersist with MaxList

Postby mefTrader » 20 Apr 2012

Im using the same version as you

I am using the playback tick by tick on a 1 min chart to generate this output

I do not use your Lastbaronchart logic?

mefTrader
Posts: 141
Joined: 23 Jun 2011
Has thanked: 9 times
Been thanked: 7 times

Re: Using Intrabarpersist with MaxList

Postby mefTrader » 20 Apr 2012

restarted MC and recompiled - seems to be okay now

Dont know what caused that

User avatar
JoshM
Posts: 2075
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1523 times
Been thanked: 1480 times
Contact:

Re: Using Intrabarpersist with MaxList

Postby JoshM » 20 Apr 2012

Thanks for the update. Glad you have it fixed. :)


Return to “MultiCharts”