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
using intrabarpersist
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
Hi itai007,
If I understand your description correctly, the cold below should do the job:
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;
intrabarpersist
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
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
- TJ
- Posts: 7740
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2221 times
try this:
Code: Select all
var: intrabarpersist playbar(0);
if playbar <> currentbar then
begin
playbar = currentbar;
{statements}
end;
Intrabarpersist help
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.
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.
- TJ
- Posts: 7740
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2221 times
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
I have just got this book, you might be interested in it also.
http://www.amazon.com/Building-Winning- ... 725&sr=8-1
- TJ
- Posts: 7740
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2221 times
if you want to learn to write in EasyLanguage, this group is full of resources:
http://finance.groups.yahoo.com/group/MrEasyLanguage/
http://finance.groups.yahoo.com/group/MrEasyLanguage/