NexusFi: Find Your Edge


Home Menu

 





Coding Your Own Stochastic Indicator


Discussion in EasyLanguage Programming

Updated
    1. trending_up 2,562 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread

Coding Your Own Stochastic Indicator

  #1 (permalink)
djvie11
Chicago, IL
 
Posts: 52 since Jul 2013
Thanks Given: 29
Thanks Received: 1

Hi Guys!

So I've been trying to code my own version of a stochastic crossover so I have more control over it. Below is my code but it's not working quite like the one that's already built into the system.

I'm trying to do this so I can get a signal on a 2 data chart (Stochastic is meant for Data2), but not having to wait until the close of Data2 to actually get the stochastic signal.

Please let me know if you think I'm missing something on the below code. Thanks!

 
Code
Inputs:
PercentK_data2 ((C of data2 - Lowest (L of data2,14)) / (Highest (H of data2,14)) - (Lowest (L of data2,14)) / 100 ) ;

Variables:
PercentD_data2 (Average (bkPercentK_data2, 3)) ;

Condition1 = bkPercentK_data2 > bkPercentD_data2 ;
Condition2 = bkPercentK_data2 < bkPercentD_data2 ;

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
Better Renko Gaps
The Elite Circle
Cheap historycal L1 data for stocks
Stocks and ETFs
Trade idea based off three indicators.
Traders Hideout
REcommedations for programming help
Sierra Chart
 
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629


djvie11,

what exactly does your code do and more important, what do you want your code to do instead?

Did you print or plot the input and variable to see if they hold the values that you expect them to have?

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #4 (permalink)
djvie11
Chicago, IL
 
Posts: 52 since Jul 2013
Thanks Given: 29
Thanks Received: 1


ABCTG View Post
djvie11,

what exactly does your code do and more important, what do you want your code to do instead?

Regards,

ABCTG

The calculations are a little screwy, and I'd also like to make the 14-period input a variable. However, when trying to make it an input, I get a "Wrong Expression" error after trying to compile the code.
(PercentK_data2 ((C of data2 - Lowest (L of data2,14)) )

Ex:
 
Code
Inputs:
14PeriodVar (1),
PercentK_data2 ((C of data2 - Lowest (L of data2,14PeriodVar)) / (Highest (H of data2,14PeriodVar)) - (Lowest (L of data2,14PeriodVar)) / 100 ) ;

Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

djvie11,

I would suggest to start with making the code easier to read and to maintain i.e. not trying to put the whole code computations into one input and variable, but instead by using several variables that you compute within your code (and not on declaration). The issue you might run into otherwise is that the variable keeps a static value, although you think it's dynamic.

A good way to verify this is by printing or plotting the actual value for input and variable in it's current form.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on October 21, 2016


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts