• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 5:47pm
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 5:47pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Stochastic divergence indicator with stochastic cross? 0 replies

Few tricky questions 11 replies

Stochastic Oscillator settings 5 replies

Stochastic slow!? 1 reply

Stochastic question from newbie. 2 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 1
Attachments: Tricky Stochastic
Exit Attachments

Tricky Stochastic

  • Post #1
  • Quote
  • First Post: Jul 10, 2008 11:25pm Jul 10, 2008 11:25pm
  •  Omniferum
  • | Joined Jun 2008 | Status: Member | 100 Posts
Then again it might not be, I can't make it work however.

Would anyone know how to code a stochastic custom indicator to give a signal only when it is passing through 0 or cross above/below a certain value? (i.e. 80/20)

The above/below isn't too difficult I know but apparently I can't get it right.

The passing through 0 though (i.e. if it is above 0 and passing through) may require a bit more thought though.

Inserted Code
  sm1=iStochastic(NULL,0,StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_MAIN,i);
  sm2=iStochastic(NULL,0,StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_MAIN,i+1);  
  ss1=iStochastic(NULL,0,StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_SIGNAL,i);
  ss2=iStochastic(NULL,0,StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_SIGNAL,i+1);  
  
if((sm1>ss1&&sm2<ss2)<20)

I'd think that would work but it ignores the <20 and paints random marks on my chart. Ignores crosses too

Fairly sure with the passing through 0 though it would require referring to a previous bar but does one assign a range or static value? I'd have to tweak it of course but if anyone could quickly show me i'd appreciate it
  • Post #2
  • Quote
  • Jul 10, 2008 11:37pm Jul 10, 2008 11:37pm
  •  howdytest
  • | Joined Jan 2007 | Status: Member | 95 Posts
I've never done this, but couldn't you do something like:

extern int alertnum //number you want to be alert at the cross

int stochtotal = sm1 + sm2 + ss1 +ss2
if (stochtotal = 0 | alertnum)
{
.....

again, this might only work inside my head, but it seems like if you have nothing else, it's easy enough to try.

Best of luck. Hopefully someone with more knowledge than I can give you a definite answer.
  • Post #3
  • Quote
  • Jul 10, 2008 11:39pm Jul 10, 2008 11:39pm
  •  Omniferum
  • | Joined Jun 2008 | Status: Member | 100 Posts
Found a previous thread requesting pretty much the exact same thing

http://www.forexfactory.com/showthre...ght=stochastic

nothing in it usable though

It is codable though, which is the more important part
  • Post #4
  • Quote
  • Jul 10, 2008 11:43pm Jul 10, 2008 11:43pm
  •  Omniferum
  • | Joined Jun 2008 | Status: Member | 100 Posts
Thanks for the suggestion howdytest but if it that code actually works I can't get it to
  • Post #5
  • Quote
  • Jul 11, 2008 4:33am Jul 11, 2008 4:33am
  •  Omniferum
  • | Joined Jun 2008 | Status: Member | 100 Posts
Thought it would help if I posted the indicator that required editing
Attached File
File Type: mq4 AO_AC_Stoch Cross.mq4   4 KB | 198 downloads
  • Post #6
  • Quote
  • Jul 11, 2008 5:53am Jul 11, 2008 5:53am
  •  DaveL
  • | Joined Aug 2006 | Status: Member | 142 Posts
Try this ...

Inserted Code
  
sm1=iStochastic(NULL,0,StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_MAIN,i);
sm2=iStochastic(NULL,0,StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_MAIN,i+1);  
ss1=iStochastic(NULL,0,StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_SIGNAL,i);
ss2=iStochastic(NULL,0,StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_SIGNAL,i+1); 
 
double limit=20;  // your crossing point value (0, 20, or 80, etc) 
 
if(sm2<limit && sm1>limit) .... // main line crossed above the limit 
if(sm2>limit && sm1<limit) .... // main line crossed below the limit 
 
if(ss2<limit && ss1>limit) .... // signal line crossed above the limit 
if(ss2>limit && ss1<limit) .... // signal line crossed below the limit
Dave
  • Post #7
  • Quote
  • Jul 11, 2008 6:42am Jul 11, 2008 6:42am
  •  Omniferum
  • | Joined Jun 2008 | Status: Member | 100 Posts
Tsk, dammit DaveL always comes to my rescue.

Thanks again DaveL, it solves the 'passing' value of 0 quite happily but i'm not sure how I would incorporate this into a stoch cross above/below a certain value.

The passing through 0 value is my attempt at adding to more signals to buy/sell, that's all. I'm merely trying to filter so the indicator only gives signals when a cross happens above a certain value.
  • Post #8
  • Quote
  • Jul 11, 2008 6:49am Jul 11, 2008 6:49am
  •  Omniferum
  • | Joined Jun 2008 | Status: Member | 100 Posts
Ah bugger I REALLY need to remind myself (and anyone else that may be confused) is that I have stochastic overlayed on Bill Williams AC.

The value of 0 for AC would be the same value as 50 for stochastic, I keep saying 0 purely because when I look at the chart it says 0 line.
  • Post #9
  • Quote
  • Last Post: Jul 11, 2008 3:39pm Jul 11, 2008 3:39pm
  •  Omniferum
  • | Joined Jun 2008 | Status: Member | 100 Posts
i'm trying to get the indicator to register with the 0 line of ac instead of at the 50 mark, thing is the 0 line of ac does tend to shift up and down.

double limit=NOIDEA is all that I need but I can't put in an iteration of iAC, which is all I could think of. Putting in another statement of iAC value didn't make sense to me as I need to merely refer to another indicator for a static value.

I'll scour the forums, if I find anything i'll post here
  • Platform Tech
  • /
  • Tricky Stochastic
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2021