stochastic now versus 1 bar ago - futures io
futures io futures trading



stochastic now versus 1 bar ago


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one ABCTG with 1 posts (0 thanks)
    2. looks_two westofpluto with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 clzppt with 1 posts (0 thanks)
    1. trending_up 489 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 3 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

stochastic now versus 1 bar ago

(login for full post details)
  #1 (permalink)
Encinitas
 
 
Posts: 4 since Jan 2019
Thanks: 0 given, 0 received

I'm new to easy language and I'm a bit confused about the syntax when comparing the value of the stochastic now versus one bar ago.

The stochastic is computed as follows:

ok = Stochastic(High, Low, Close, 14, 3, 3, 1, oFastK, oFastD, oSlowK, oSlowD);

And the "value" I am looking for is oSlowK - oSlowD. So this is the value at the current bar. How do I get the value at the previous bar? One possibility is this:

ok2 = Stochastic(High[1], Low[1], Close[1], 14, 3, 3, 1, oFastK1, oFastD1, oSlowK1, oSlowD1);
value1 = oSlowK1 - oSlowD1

But is it also (instead) possible to just use this:

value1 = oSlowK[1] = oSowD[1];

What is the correct syntax?

Reply With Quote

Can you help answer these questions
from other members on futures io?
Learning By Example [Request]
NinjaTrader
Webinar: Finding your own way in trading w/Adam Grimes
The Elite Circle
What blockvolume is visible? - order processing
NinjaTrader
OFA (Order Flow Analytics) Licence
NinjaTrader
Short Interest Ratio indicator?
ThinkOrSwim
 
 
(login for full post details)
  #3 (permalink)
Huntsville, AL
 
Experience: Intermediate
Platform: TradeStation
Broker: Tradestation
Trading: Index Futures
 
Posts: 10 since Jun 2014
Thanks: 1 given, 0 received



westofpluto View Post
ok2 = Stochastic(High[1], Low[1], Close[1], 14, 3, 3, 1, oFastK1, oFastD1, oSlowK1, oSlowD1);
value1 = oSlowK1 - oSlowD1


westofpluto View Post
value1 = oSlowK[1] = oSowD[1];

I believe the two code snippets should provide exactly the same answer. As a test, put both sets of code in the same indicator and plot them. I would expect they would be the same line.

Reply With Quote
 
(login for full post details)
  #4 (permalink)
 
 
Posts: 2,230 since Apr 2013
Thanks: 409 given, 1,471 received

westofpluto,

you can reference previous bar's values for variables (just like you can do for some reserved words) using [x], where x is the number of bars back starting from the current bar, which is 0.
In your case both ways will work, but since you likely call the stochastic already within your code getting the previous bars values using oSlowK[1] and oSowD[1] will be more efficient.

If you haven't done so already, I would suggest checking out the free EasyLanguage Essentials PDF that you can download on the Tradestation website. It will bring you up to speed in terms of the basics of EasyLanguage.

Regards,

ABCTG

Follow me on Twitter Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > stochastic now versus 1 bar ago


Last Updated on January 28, 2019


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts