logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
nishant  
#1 Posted : Tuesday, June 21, 2011 1:54:05 AM(UTC)
nishant

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 3/9/2007(UTC)
Posts: 35

Thanks: 1 times
Hello fellow traders, This is what i'm looking for... The basic thing is Stochastic(14,3,3) with %K & %D cross when it is in 80/20 zone. But i wish to know the formula when %K & %D gives crossover again for the second time without having dipped below/above 80/20 levels. Its like 2 consecutive crossovers. A situation may contain 3 consecutive crossovers or perhaps more than that as well.. But formula for 2 consecutive is required.. Here is the link bearing the charts for better explanation... http://img64.imageshack....64/569/multiplecross.png What i wish to have is both Exploration formula & Expert Advisor.. Best, Nishant
jjstein  
#2 Posted : Tuesday, June 21, 2011 6:35:29 AM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
You're going to have to explain that better.

nishant  
#3 Posted : Wednesday, June 22, 2011 12:54:08 AM(UTC)
nishant

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 3/9/2007(UTC)
Posts: 35

Thanks: 1 times
yes, i understand.. and i wish there was an option to upload charts.. that would have made the things clearer...
nishant  
#4 Posted : Wednesday, June 22, 2011 1:08:07 AM(UTC)
nishant

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 3/9/2007(UTC)
Posts: 35

Thanks: 1 times
Here is the link bearing the chart... http://img64.imageshack....64/569/multiplecross.png i just hope the expanation turns out to be better... Kindly help...
oztrader  
#5 Posted : Wednesday, June 22, 2011 7:02:43 AM(UTC)
oztrader

Rank: Advanced Member

Groups ready for retrieval: Registered, Registered Users, Unverified Users
Joined: 7/12/2007(UTC)
Posts: 134
Location: Perth Western Australia

StochK: = Stoch(14,3); StochD: = Mov(StochK,3,S); EventxDK: = StochK >= 80 AND Cross(StochD,StochK); CountxDK: = Cum(EventxDK); ResetxDK: = Cross(80,StochK); CounterxDK: = CountxDK - ValueWhen(1,ResetxDK,CountxDK); EventxKD: = StochK "less than or equal to" 20 AND Cross(StochK,StochD); CountxKD: = Cum(EventxKD); ResetxKD: = Cross(StochK,20); CounterxKD: = CountxKD - ValueWhen(1,ResetxKD,CountxKD); If(Cross(CounterxDK = 2,0.5),1, If(Cross(CounterxKD = 2,0.5),-1,0)) Please substitute the symbols to replace "less than or equal to" 20 in line 7 of the code. Interpretation of output:- A "1" is recorded on the bar when %D crosses above %K twice whilst %K is greater than or equal to 80, a "-1" is recorded on the bar when %K crosses above %D twice whilst %K is less than or equal to 20 and a "0" is recorded on all other bars.
nishant  
#6 Posted : Wednesday, June 22, 2011 11:40:28 PM(UTC)
nishant

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 3/9/2007(UTC)
Posts: 35

Thanks: 1 times
@oztrader... sorry but am unable to make it work.. i tried to put the code in both Exploration and EA... but some error is coming... how to make it work?...
oztrader  
#7 Posted : Thursday, June 23, 2011 1:47:51 AM(UTC)
oztrader

Rank: Advanced Member

Groups ready for retrieval: Registered, Registered Users, Unverified Users
Joined: 7/12/2007(UTC)
Posts: 134
Location: Perth Western Australia

Create a new indicator called "Stochastic x 2" and copy the code above into the new indicator and remember to change line 7 to use symbols as per my post. Insert the indicator in a new inner window on the chart of a security and use the "Interpretation of Output" from the above post to explain what a 1 or -1 means. When you run an Exploration try the following:- {ColA} Fml("Stochastic x 2")=1 {x's in overbought area} {ColA} Fml("Stochastic x 2")=-1 {x's in oversold area}
jjstein  
#8 Posted : Thursday, June 23, 2011 10:06:59 PM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
OK, I think I've got it:

_Stochastic

StochK:=Stoch(5,3);
StochD:=Mov(StochK,3,S);
{* Sell *}
CrossSell:=Cross(StochD,StochK) AND Ref(StochK>80,-1);
CrossCount:=Ref(BarsSince(CrossSell),-1);
flag:=CrossCount<BarsSince(Cross(StochK,80));
Sell:=CrossSell AND flag;
{* Buy *}
CrossBuy:=Cross(StochK,StochD) AND Ref(StochK<20,-1);
CrossCount:=Ref(BarsSince(CrossBuy),-1);
flag:=CrossCount<BarsSince(Cross(20,StochK));
Buy:=CrossBuy AND flag;

If(Buy,1,if(Sell,-1,0));

It should look like this:
UserPostedImage

For the Exploration, use FML("_Stochastic")=1 for BUY, FML("_Stochastic")=-1 for SELL.

Same for the Expert SYMBOLS tab. If you want to do TREND or HIGHLIGHTS, we'd have to add code to filter signals.

jjstein  
#9 Posted : Thursday, June 23, 2011 10:08:52 PM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
For future reference, you can drag 'n drop graphics to imgur.com, then use the "Messages Boards" option to copy & paste into the message.


nishant  
#10 Posted : Tuesday, June 28, 2011 2:41:53 AM(UTC)
nishant

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 3/9/2007(UTC)
Posts: 35

Thanks: 1 times
Thank you so much for the codification... It is of immense help!
nishant  
#11 Posted : Wednesday, June 29, 2011 12:40:31 AM(UTC)
nishant

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 3/9/2007(UTC)
Posts: 35

Thanks: 1 times
I'd been progessing with research on the same technique and realized that "Triple Cross" is working better than the "Double Cross"... Johnathon's codification is behaving the exact way resulting in plotting of Double Crosses... But how the same can be modified so as to yield "Triple Crosses" as against Double as it is providing more utility... I tried to modify but failing to get the results... I'm certainly failing to understand the logic behind formula creation...
oztrader  
#12 Posted : Wednesday, June 29, 2011 3:25:09 AM(UTC)
oztrader

Rank: Advanced Member

Groups ready for retrieval: Registered, Registered Users, Unverified Users
Joined: 7/12/2007(UTC)
Posts: 134
Location: Perth Western Australia

Create the following as an Indicator and attach it to a chart in a seperate inner window (The indicator output will be obvious):- Stochastic_Cross_Counter
Code:

StochK:=Stoch(14,3);
StochD:=Mov(StochK,3,S);
EventxDK:=StochK>80 AND Cross(StochD,StochK);
CountxDK:=Cum(EventxDK);
ResetxDK:=Cross(80,StochK);
CounterxDK:=CountxDK-ValueWhen(1,ResetxDK,CountxDK);
EventxKD:=StochK<20 AND Cross(StochK,StochD);
CountxKD:=Cum(EventxKD);
ResetxKD:=Cross(StochK,20);
CounterxKD:=CountxKD-ValueWhen(1,ResetxKD,CountxKD);
If(StochK>80,CounterxDK,
If(StochK<20,CounterxKD,0))
In EXPLORATIONS use:- Scan for Overbought
Code:

 FmlVar("Stochastic_Cross_Counter","COUNTERXDK")=3
Scan for Oversold
Code:

FmlVar("Stochastic_Cross_Counter","COUNTERXKD")=3
You can also use the same code for EXPERT HIGHLIGHTS and SYMBOLS. If you decide to test "Quadriple Crosses" then all you need to do is change the EXPLORATION from =3 to =4
jjstein  
#13 Posted : Monday, August 22, 2011 6:19:55 PM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
Oz -- For some reason, I'm only getting this today, 22 Aug 11, but it says it was posted 29 Jun 11.

Aside from the "slight" delay, the system seems to have messed up your code, too. Could you check & repost?

jjstein  
#14 Posted : Wednesday, August 24, 2011 12:04:58 AM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
Since the forum seems to have messed up oztrader's code, will attempt to repost:

{* Stochastic_Cross_Counter *}
StochK:=Stoch(14,3);
StochD:=Mov(StochK,3,S);
EventxDK:=StochK>80 AND Cross(StochD,StochK);
CountxDK:=Cum(EventxDK);
ResetxDK:=Cross(80,StochK);
CounterxDK:=CountxDK-ValueWhen(1,ResetxDK,CountxDK);
EventxKD:=StochK<20 AND Cross(StochK,StochD);
CountxKD:=Cum(EventxKD);
ResetxKD:=Cross(StochK,20);
CounterxKD:=CountxKD-ValueWhen(1,ResetxKD,CountxKD);
If(StochK>80,(StochK>80)*CounterxDK,
If(StochK<20,(StochK<20)*-CounterxKD,0))


Explorations & Experts
----------------------
{* Scan for Overbought *}

Fml("Stochastic_Cross_Counter")=3 { Triple cross }

{* Scan for Oversold *}

Fml("Stochastic_Cross_Counter")=-3 { Triple cross }


oztrader  
#15 Posted : Wednesday, August 24, 2011 4:19:34 AM(UTC)
oztrader

Rank: Advanced Member

Groups ready for retrieval: Registered, Registered Users, Unverified Users
Joined: 7/12/2007(UTC)
Posts: 134
Location: Perth Western Australia

Thanks for doing that on my behalf Johnathan. Hopefully I will eventually be able to post code which includes the "less than" symbol without causing a problem.
nishant  
#16 Posted : Monday, November 7, 2011 12:35:47 AM(UTC)
nishant

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 3/9/2007(UTC)
Posts: 35

Thanks: 1 times
Thank you so much Oz & Johnathan for the codification.... thanks!
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.