using intrabarpersist

Questions about MultiCharts and user contributed studies.
itai007
Posts: 69
Joined: 14 Jun 2007

using intrabarpersist

Postby itai007 » 30 Jan 2008

Hi..

lets say I would like to buy when the current 3 min bar rsi crosess over 70 the second it happens within the bar and only 1.

So the minute the second rsi crosess over 70 I buy but will not repeet that trigger as long as my marketposition > 0

how do I code this

thanks

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Postby Marina Pashkova » 31 Jan 2008

Hi itai007,

If I understand your description correctly, the cold below should do the job:

Code: Select all

inputs:
Price( Close ),
Length( 14 ),
OverSold( 30 ),
OverBought( 70 );


variables: MyRSI( 0 ) ;

MyRSI = RSI( Price, Length ) ;

if MyRSI crosses over OverBought then
buy 1 contract this bar on Close;

itai007
Posts: 69
Joined: 14 Jun 2007

intrabarpersist

Postby itai007 » 01 Feb 2008

may be I didn't make my self clear ...

I would like my strategy to sell intrabar when a threshold is hit.

with the rsi example , using a 5 min bar with rsi(c,14) and sell threshold 70, it might trigger several times with the fluctuation of the bar.

different from what I asked in the original post, I would like the strategy , using intrabarpersist function, to sell every time the last tick crosses the 70 threshold within that bar (I can limit the amount of contracts in the strategy properties to 5 contracts) so if the rsi fluctuates above and bellow the 70 level within a bar 5 times or more, it will sell 5 contracts total.

specifically I would like to understand how to use and correctly position the intrabarpersist function within the code ...

Thanks

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

Postby TJ » 01 Feb 2008

try this:

Code: Select all

var: intrabarpersist playbar(0);

if playbar <> currentbar then

begin

playbar = currentbar;
{statements}

end;

itai007
Posts: 69
Joined: 14 Jun 2007

Intrabarpersist help

Postby itai007 » 04 Feb 2008

Im sorry but I cant make out of this.

I need the full code for the following (example)
As this replicates an internal fluctuation any or most bars have due to fair values specifically with futures.

I would like to do the following:

interval is 1 minute chart
Rsi(c.5)

intrabarpersist for intrabar trading enabling.

if rsi(c,5) > 50 and Rsi(c,5)[1]<=50 then buy(now!!)

immediately enter sell limit @ entry price + 1 tick (or min move depending of the future).

let this process trade infinitely.

I need the exact code for this.
thanks.

itai007
Posts: 69
Joined: 14 Jun 2007

intrabarpersist

Postby itai007 » 06 Feb 2008

can any 1 help me genrate these intrabar orders?

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

Postby TJ » 07 Feb 2008

I have written a few indicators, but have not tried trading systems yet.

I have just got this book, you might be interested in it also.

http://www.amazon.com/Building-Winning- ... 725&sr=8-1

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

Postby TJ » 07 Feb 2008

if you want to learn to write in EasyLanguage, this group is full of resources:

http://finance.groups.yahoo.com/group/MrEasyLanguage/


Return to “MultiCharts”