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


TradeStation Pivot function conversion
Updated: Views / Replies:441 / 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

Reply
 
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 }

inputs:
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 ) ;

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

InstanceCntr = 0 ;
InstanceTest = false ;
LengthCntr = RightStrength ;
while LengthCntr < Length and InstanceTest = false
begin
{ GET NEXT MOST RECENT CandidatePrice & SET STARTING ASSUMPTION
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
begin
if ( HiLo = 1 and CandidatePrice < Price[StrengthCntr] )
or ( HiLo = -1 and CandidatePrice > Price[StrengthCntr] ) then
PivotTest = false
else
StrengthCntr = StrengthCntr + 1 ;
end ;
{ IF CandidatePrice SURVIVED LEFT COMPARISON, NOW COMPARE TO
RightStrength BARS ON RIGHT: }
StrengthCntr = LengthCntr - 1 ;
while PivotTest = true and LengthCntr - StrengthCntr <= RightStrength
begin
if ( HiLo = 1 and CandidatePrice <= Price[StrengthCntr] )
or ( HiLo = -1 and CandidatePrice >= Price[StrengthCntr] ) then
PivotTest = false
else
StrengthCntr = StrengthCntr - 1 ;
end ;
{ IF CandidatePrice SURVIVED OVERALL AS Pivot, INCREMENT InstanceCntr: }
if PivotTest = true then
InstanceCntr = InstanceCntr + 1 ;
{ IF InstanceCntr HAS REACHED REQUIRED COUNT, THEN THIS IS THE DESIRED Pivot,
ELSE INCREMENT LengthCntr TO PREPARE TO GET AND TEST NEXT CANDIDATE PRICE: }
if InstanceCntr = Instance then
InstanceTest = true
else
LengthCntr = LengthCntr + 1 ;
end ;
if InstanceTest = true then
begin
oPivotPrice = CandidatePrice ;
oPivotBar = LengthCntr + ExecOffset ;
Pivot = 1 ; { return 1 if required pivot found }
end
else
begin
oPivotPrice = -1 ;
oPivotBar = -1 ;
Pivot = -1 ; { return -1 if required pivot not found }
end ;

{
MULTIPLE-OUTPUT FUNCTIONS

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. ** }


Thanks,
Pete

Reply With Quote

Reply



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)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

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


All times are GMT -4. The time now is 07:52 PM.

Copyright © 2017 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
Page generated 2017-12-15 in 0.07 seconds with 19 queries on phoenix via your IP 54.163.61.66