NexusFi: Find Your Edge


Home Menu

 





How to code this set up ?


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one Ty199 with 11 posts (5 thanks)
    2. looks_two mtzimmer1 with 5 posts (8 thanks)
    3. looks_3 CodingDummy with 3 posts (1 thanks)
    4. looks_4 JonnyBoy with 1 posts (0 thanks)
    1. trending_up 4,070 views
    2. thumb_up 14 thanks given
    3. group 6 followers
    1. forum 20 posts
    2. attach_file 2 attachments




 
Search this Thread

How to code this set up ?

  #1 (permalink)
Ty199
Joplin, Mo. Jasper
 
Posts: 47 since Sep 2019
Thanks Given: 16
Thanks Received: 47

I dont know anything about coding. I tried and just not that smart lol. But been playing with a formula that seems to work pretty good. But instead of adding it all up, is there a way to have it coded so TOS does it?
Pretty simple maybe ?
It is previous day High and Low subtracted from each other.
Then that value would be divided by 4
That would then be added on the next day open and also be subtracted from the next day open.
So there would be 2 lines, a high and a low applied to the chart.

It is figured like this.
Previous day High 58.70 Previous day Low 53.20
These are now subtracted for the difference which is 5.50
That value is divided by 4 which values at 1.375
Now 1.375 is added to the next day open price (ex. open price is 56.10 + 1.375 = 57.475 )
It is also subtracted from the open price ( ex. open price is 56.10 - 1.375 = 54.725 )
Now you have a high and a low that is calculated automatically and placed on the chart for that day of trading.
High 57.475 Low 54.725. There is no need the number to be odd as it is not rounded. (ex. 54.725 change up or down to a whole number such as 54.72)
I tried to write something up and it just dont even come close to working. Is there a way to even calculate this to be added as a study ?
All help is much welcome.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
Trade idea based off three indicators.
Traders Hideout
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Bigger Wins or Fewer Losses?
24 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
  #2 (permalink)
 
wldman's Avatar
 wldman 
Chicago Illinois USA
Legendary Market Wizard
 
Experience: Advanced
Broker: IB, ToS
Trading: /ES, US Equities/Options
Frequency: Several times daily
Duration: Hours
Posts: 3,512 since Aug 2011
Thanks Given: 2,047
Thanks Received: 9,513

Like you I am not a code guy, but I persist in at least trying because the code community, especially on ToS, will respect the effort and maybe point the way.

What you are thinking about or something very similar was/is and idea that has been widely used in the past by someone whose name I'm not going to mention.

Daily Range Projections do lend themselves to the notion of a statistical model. The "data run" for which is quite simple.

Here is what I used. Even I was able to script this for Ninjatrader.

If period close < period open use: (H+L+L+C)/2 = X
If period close > period open use: (L+H+H+C)/2= X
If period close = period open use: (H+L+L+C)/2 = X

To calculate range projections for the next period..

For each of the formulas, to calc next period projected high, subtract current period L from X. To Calc next period projected low, subtract current period H from X.

So a basic model could be when price moves this direction from open some number of ticks 70% of the time it continues some distance before/without retrace.

Here is the thing. If you SHOW the attempt and the result, guys with the skill will believe you. Otherwise it just looks like you want someone else to do the work for you. When they see that you are trying they will correct your errors and give advice.

Good Luck.

-Dan

Visit my NexusFi Trade Journal Reply With Quote
  #3 (permalink)
Ty199
Joplin, Mo. Jasper
 
Posts: 47 since Sep 2019
Thanks Given: 16
Thanks Received: 47


Thank you, I will keep trying and post results. I have a hard time making the plot
<high of previous day - low of previous day = A>
<A / 4 = B>
<B + open price = C placed on chart>
<B - open price = D placed on chart>

I try to put this in and it dont recognize any values. Its like I watch all the videos that show how to code but for some reason I dont get the same or formula or anything. I would love to be able to code on TOS . I have several methods I would love to try that would would alert at a price point and trend directions , pivot points, possible buy and sell signals. I love just testing new strategies and seeing what works under normal market behavior.
Thanks for the help and I will keep plugging away at it.

Reply With Quote
  #4 (permalink)
 
mtzimmer1's Avatar
 mtzimmer1 
Upstate NY
Recovering Method Hopper
 
Experience: Intermediate
Platform: TOS
Broker: TD Ameritrade
Trading: Equities, Treasuries, Gold
Posts: 840 since Dec 2018
Thanks Given: 2,201
Thanks Received: 1,918

I can code this up when I get back to my computer tonight!

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #5 (permalink)
Ty199
Joplin, Mo. Jasper
 
Posts: 47 since Sep 2019
Thanks Given: 16
Thanks Received: 47


mtzimmer1 View Post
I can code this up when I get back to my computer tonight!

That would be awesome. But would you be able to help me understand what everything means? I dont understand where I go wrong. I try and I am putting things in wrong spaces or leaving something out.

Reply With Quote
Thanked by:
  #6 (permalink)
 
mtzimmer1's Avatar
 mtzimmer1 
Upstate NY
Recovering Method Hopper
 
Experience: Intermediate
Platform: TOS
Broker: TD Ameritrade
Trading: Equities, Treasuries, Gold
Posts: 840 since Dec 2018
Thanks Given: 2,201
Thanks Received: 1,918

declare upper;


def y_high = high(period=aggregationperiod.day)[1];
def y_low = low(period=aggregationperiod.day)[1];

def y_range = y_high-y_low;

def d_open = open(period=aggregationPeriod.DAY);

plot upper = d_open+(.25*y_range);

plot lower = d_open-(.25*y_range);

#########

This should work nicely. I'm headed to bed now but tag me with any questions and I'm happy to respond tomorrow!

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #7 (permalink)
Ty199
Joplin, Mo. Jasper
 
Posts: 47 since Sep 2019
Thanks Given: 16
Thanks Received: 47


mtzimmer1 View Post
declare upper;


def y_high = high(period=aggregationperiod.day)[1];
def y_low = low(period=aggregationperiod.day)[1];

def y_range = y_high-y_low;

def d_open = open(period=aggregationPeriod.DAY);

plot upper = d_open+(.25*y_range);

plot lower = d_open-(.25*y_range);

#########

This should work nicely. I'm headed to bed now but tag me with any questions and I'm happy to respond tomorrow!

Thank you so much !! this is awesome. I need to learn this coding more. I can get close but I still need work.
But Im running this on /QM /CL /NG /PL you can see how it breaks out of the high and low lines. So cool !! I added some daily support and resistance lines to my chart and looks like it gives some great exit points of the trade. It also looks like you can do a 2 to 1 risk management. Risk $50 and look at $100 to cover. Most looks like it will go more than 2 to 1, about 4 to 1 LOL..... This is sweet, Please I need to learn more on this coding. How do you do this ??

Reply With Quote
Thanked by:
  #8 (permalink)
 
mtzimmer1's Avatar
 mtzimmer1 
Upstate NY
Recovering Method Hopper
 
Experience: Intermediate
Platform: TOS
Broker: TD Ameritrade
Trading: Equities, Treasuries, Gold
Posts: 840 since Dec 2018
Thanks Given: 2,201
Thanks Received: 1,918

Hey I'm glad it is working for you!

Coding is one of those things you just need to look at and troubleshoot over and over again until it sinks in.

I would be more than happy to work with you on learning the basics of coding. You come up with ideas and I'll code them up and try to explain why each function does what it does. Win for both of us!

Cheers my friend,
Zimmer

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #9 (permalink)
Ty199
Joplin, Mo. Jasper
 
Posts: 47 since Sep 2019
Thanks Given: 16
Thanks Received: 47


mtzimmer1 View Post
Hey I'm glad it is working for you!

Coding is one of those things you just need to look at and troubleshoot over and over again until it sinks in.

I would be more than happy to work with you on learning the basics of coding. You come up with ideas and I'll code them up and try to explain why each function does what it does. Win for both of us!

Cheers my friend,
Zimmer

Sounds Great and I appreciate it so much ! I have one that involves a few indicators for US bonds. It does ok and made a few good trades from it. But Im going to run this on Paper for a few days and see the profit / loss ratio is and how many trades that are positive and negative. Im trying to come up with a good buy area after it shows a break out and a stop loss and target profit. I will make a few rules on trading it and sticking by it and post the results back here. I appreciate your help so much and will be sending you a PM here soon on the coding. Thanks !!!

Reply With Quote
Thanked by:
  #10 (permalink)
 
JonnyBoy's Avatar
 JonnyBoy 
Montreal, Quebec
 
Experience: Advanced
Platform: NinjaTrader 8
Broker: Kinetick
Trading: ES
Posts: 1,561 since Apr 2012
Thanks Given: 706
Thanks Received: 3,858



mtzimmer1 View Post
declare upper;


def y_high = high(period=aggregationperiod.day)[1];
def y_low = low(period=aggregationperiod.day)[1];

def y_range = y_high-y_low;

def d_open = open(period=aggregationPeriod.DAY);

plot upper = d_open+(.25*y_range);

plot lower = d_open-(.25*y_range);

#########

This should work nicely. I'm headed to bed now but tag me with any questions and I'm happy to respond tomorrow!

I don't use T.O.S but when guys have completed development of this, consider uploading to the download section. I like what you doing here, and it could help out others.

--------------------------------------------------------
- Trade what you see. Invest in what you believe -
--------------------------------------------------------
Reply With Quote




Last Updated on September 18, 2019


© 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