TradeStation Pivot function conversion - ThinkOrSwim | futures io social day trading
futures io futures trading

TradeStation Pivot function conversion
Updated: Views / Replies:500 / 0
Created: by petelegus72 Attachments:0

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • 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.

-- Big Mike, Site Administrator

Thread Tools Search this Thread

TradeStation Pivot function conversion

  #1 (permalink)
Trading Apprentice
raleigh, north carolina
Futures Experience: Beginner
Platform: thinkorswim, tradestation
Favorite Futures: Stocks
Posts: 1 since Dec 2014
Thanks: 0 given, 0 received

TradeStation Pivot function conversion

Hi Guys,

new here and to tos.

I'm trying to figure out the most efficient way to convert the TradeStation Pivot function for use in a tos study. I've looked and can't find similar code in tos. I really just want to be able to set the condition on a bar if it's a pivot or not. Any help would be appreciated... Here is the TS function:

{ Multiple-output function; see MULTIPLE-OUTPUT FUNCTIONS note below }

Price( numericseries ),
Length( numericsimple ),
LeftStrength( numericsimple ),
RightStrength( numericsimple ),
Instance( numericsimple ),
HiLo( numericsimple ), { pass in 1 for PivotHigh(Bar), -1 for PivotLow(Bar) }
oPivotPrice( numericref ),
oPivotBar( numericref ) ;

CandidatePrice( 0 ),
LengthCntr( 0 ),
StrengthCntr( 0 ),
InstanceCntr( 0 ),
PivotTest( false ),
InstanceTest( false ) ;

InstanceCntr = 0 ;
InstanceTest = false ;
LengthCntr = RightStrength ;
while LengthCntr < Length and InstanceTest = false
THAT IT IS A Pivot: }
CandidatePrice = Price[LengthCntr] ;
PivotTest = true ;
{ COMPARE CandidatePrice TO LeftStrength BARS ON LEFT: }
StrengthCntr = LengthCntr + 1 ;
while PivotTest = true and StrengthCntr - LengthCntr <= LeftStrength
if ( HiLo = 1 and CandidatePrice < Price[StrengthCntr] )
or ( HiLo = -1 and CandidatePrice > Price[StrengthCntr] ) then
PivotTest = false
StrengthCntr = StrengthCntr + 1 ;
end ;
RightStrength BARS ON RIGHT: }
StrengthCntr = LengthCntr - 1 ;
while PivotTest = true and LengthCntr - StrengthCntr <= RightStrength
if ( HiLo = 1 and CandidatePrice <= Price[StrengthCntr] )
or ( HiLo = -1 and CandidatePrice >= Price[StrengthCntr] ) then
PivotTest = false
StrengthCntr = StrengthCntr - 1 ;
end ;
{ IF CandidatePrice SURVIVED OVERALL AS Pivot, INCREMENT InstanceCntr: }
if PivotTest = true then
InstanceCntr = InstanceCntr + 1 ;
if InstanceCntr = Instance then
InstanceTest = true
LengthCntr = LengthCntr + 1 ;
end ;
if InstanceTest = true then
oPivotPrice = CandidatePrice ;
oPivotBar = LengthCntr + ExecOffset ;
Pivot = 1 ; { return 1 if required pivot found }
oPivotPrice = -1 ;
oPivotBar = -1 ;
Pivot = -1 ; { return -1 if required pivot not found }
end ;


A multiple-output function has two types of parameters or "inputs" - input parameters
and input/output parameters. The values of the input parameters are passed into the
multiple-output function, but not modified by the function. The values of the input/
output parameters are passed into the multiple-output function, modified by it, and
the modified values are then inherited by - or output to - the calling routine.

The input/output parameters are often used for output purposes only, i.e., the
incoming values are ignored. The outputs are in addition to the function return. In
multiple-output functions, the function return is generally used to return an error
code, though sometimes the return may simply be a dummy value.

The input/output parameters are declared with a "ref" suffix (such as "numericref") in
the multiple-output function's declaration statements. For further clarity, the names
of the input/output parameters are generally prefixed with an "o" in the function as
well as in all the routines that call the function.

The built-in single-return WRAPPER FUNCTIONS that call the multiple-output functions
are specialized calling routines designed to offer simplified, alternate pathways to
the functionality of the underlying multiple-output functions. In the wrapper
functions, the input/output parameters are declared as local variables and generally
initialized to zero. They are passed through to the multiple-output function without
further modification. After the call, the wrapper function picks out the single
output of interest and assigns it as the return of the wrapper function.

{ ** Copyright (c) 2001 - 2010 TradeStation Technologies, Inc. All rights reserved. **
** TradeStation reserves the right to modify or overwrite this analysis technique
with each release. ** }


Reply With Quote


futures io > > > > TradeStation Pivot function conversion

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Wyckoff Hunting for Great Risk/Reward Ratio w/Gary Fullett

Elite only

Digging into the Details of iSystems w/Stage 5 & iSystems

Jun 5

Similar Threads
Thread Thread Starter Forum Replies Last Post
Currency Conversion Only German Traders 4 June 6th, 2014 09:56 AM
conversion of CCI pivot zones FKtrader Sierra Chart 7 May 28th, 2014 11:49 AM
How to use if() function to check value returned from cross() function vampirelord AmiBroker 4 March 28th, 2014 12:23 PM
TradeStation EL -> thinkScript Conversion StockJock ThinkOrSwim Programming 14 October 27th, 2012 03:00 PM

All times are GMT -4. The time now is 08:43 PM.

Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432,
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 2018-05-23 in 0.09 seconds with 19 queries on phoenix via your IP