Need help in modifying stochastic for price forward projection - Sierra Chart Programming | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > Sierra Chart > Sierra Chart Programming

Need help in modifying stochastic for price forward projection
Started:February 9th, 2016 (04:27 PM) by sw88 Views / Replies:167 / 1
Last Reply:February 9th, 2016 (04:27 PM) Attachments:0

Welcome to

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

Need help in modifying stochastic for price forward projection

Old February 9th, 2016, 04:27 PM   #1 (permalink)
Elite Member
New Haven, CT/USA
Futures Experience: Beginner
Platform: MT4, thinkorswim
Favorite Futures: stocks
Posts: 34 since Jul 2015
Thanks: 5 given, 3 received

Need help in modifying stochastic for price forward projection

I want to add one dummy/future price one bar forward to the current bar. For example, if current bar with index 0 with H, L, open, last/close price, last bar with index [-1] with H, L, open, close price; then I want to create a dummy/future bar with index of 1, and assign H=L=open=last price of the current bar (index 0).

When I call stochastic indicator, I'd like the price of the dummy/future bar be used to calculate the value for the next bar based on the assumptive price of H=L=open=last price. I am not sure how to modify the existing source code, as it seems calling a systemic array of price history. Can someone help? appreciate very much!

Here is the source code for the slow stochastics.

SCSFExport scsf_SlowStochastic(SCStudyInterfaceRef sc)
SCSubgraphRef SlowK = sc.Subgraph[0];
SCSubgraphRef SlowD = sc.Subgraph[1];
SCSubgraphRef Line1 = sc.Subgraph[2];
SCSubgraphRef Line2 = sc.Subgraph[3];
SCSubgraphRef Temp4 = sc.Subgraph[4];

SCInputRef FastKLength = sc.Input[2];
SCInputRef FastDLength = sc.Input[3];
SCInputRef SlowDLength = sc.Input[4];
SCInputRef Line1Value = sc.Input[5];
SCInputRef Line2Value = sc.Input[6];
SCInputRef MovAvgType = sc.Input[7];
SCInputRef InputDataHigh = sc.Input[8];
SCInputRef InputDataLow = sc.Input[9];
SCInputRef InputDataLast = sc.Input[10];
SCInputRef UpdateFlag = sc.Input[11];

if ( sc.SetDefaults )
sc.GraphName = "Stochastic - Slow";

sc.ValueFormat = 2;

SlowK.Name = "Slow %K";
SlowK.PrimaryColor = RGB(0,255,0);
SlowK.DrawZeros = true;

SlowD.Name = "Slow %D";
SlowD.PrimaryColor = RGB(255,0,255);
SlowD.DrawZeros = true;

Line1.Name = "Line1";
Line1.DrawStyle = DRAWSTYLE_LINE;
Line1.PrimaryColor = RGB(255,255,0);
Line1.DrawZeros = true;

Line2.Name = "Line2";
Line2.DrawStyle = DRAWSTYLE_LINE;
Line2.PrimaryColor = RGB(255,127,0);
Line2.DrawZeros = true;

FastKLength.Name = "Fast %K Length";

FastDLength.Name = "Fast %D Length (Slow %K)";

SlowDLength.Name = "Slow %D Length";

Line1Value.Name = "Line1 Value";

Line2Value.Name = "Line2 Value";

MovAvgType.Name = "Moving Average Type";

InputDataHigh.Name = "Input Data for High";

InputDataLow.Name = "Input Data for Low";

InputDataLast.Name = "Input Data for Last";

UpdateFlag.SetInt(1); //update flag

sc.AutoLoop = true;

sc.DataStartIndex = FastKLength.GetInt() + FastDLength.GetInt() + SlowDLength.GetInt();

Temp4, // Data member is Fast %K

SlowK[sc.Index] = Temp4.Arrays[0][sc.Index];
SlowD[sc.Index] = Temp4.Arrays[1][sc.Index];

Line1[sc.Index] = Line1Value.GetFloat();
Line2[sc.Index] = Line2Value.GetFloat();



Reply With Quote

Old February 9th, 2016, 04:27 PM   #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.


Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > Sierra Chart > Sierra Chart Programming > Need help in modifying stochastic for price forward projection

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

Corey Rosenbloom: Tips, Tactics, and Real Trades: Trading Intraday Trend Reversals

Elite only

An Afternoon with FIO trader bobwest

Elite only

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to scroll chart forward past price action? north88 IB Trader Workstation 1 April 19th, 2015 04:55 PM
Indicator to plot a line x bars forward above and below the closing price skiguy NinjaTrader Programming 1 November 17th, 2013 05:46 AM
Auto ABC Projection indi jtrade NinjaTrader Programming 14 October 14th, 2013 08:59 AM
CPO (Cycle Projection Oscillator) Leo123 The Elite Circle 3 January 17th, 2012 03:36 PM
Hi all, has anybody these indicators: Widner Projection Band bstrader NinjaTrader 2 May 21st, 2010 11:52 PM

All times are GMT -4. The time now is 05:19 AM.

Copyright © 2016 by 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

Page generated 2016-10-21 in 0.08 seconds with 19 queries on phoenix via your IP