Input to CreateParameter as DateTime or text not double
Author: kelvinyip
Creation Date: 10/22/2018 2:27 PM
profile picture

kelvinyip

#1
I am writing an indicator that takes say 10/20/2018 as input. CreatePararmeter seems to take only double as input... Is there anyway to get around that ?
profile picture

superticker

#2
CreateParameter will only take double as input, which can be converted to integer on assignment if necessary. This can't be changed.

When working with Wealth-Lab, at some point you have to convert dates to "bars" (as an integer). WL has a few functions that can convert a date to bars. For example, DateTimeToBar():
CODE:
Please log in to see this code.

Some date functions (e.g. DaysBetweenDates, TradingDaysBetweenDates) are hidden in the Community.Components library. http://www2.wealth-lab.com/WL5Wiki/AllPages.aspx?Cat=Community%20Components

I would try writing your code in "bars" (integers) instead of dates whenever possible. That's more immediately useful.
profile picture

Eugene

#3
When you decide that creating a duplicate topic is inevitable, take a chance on our forum's search ;)

There are three more similar discussions:

How to have String or Boolean input parameters
String and Boolean as StrategyParameters
Boolean Strategy Parameters & DataSeries
profile picture

kelvinyip

#4
QUOTE:
"I would try writing your code in "bars" (integers) instead of dates whenever possible. That's more immediately useful."
This is actually what I have done but.... not ideal...

I kind of need to eyeball when I want to calculate my indicator on the chart, pick the begin and end dates on the chart and then insert the indicator....

Currently, I plot the bar number in a panel and move my mouse over so I can see which bar number goes with my dates and then type them into the create parameter box.

When I want to plot it with realtime quotes enabled, it doesn't work cause the last bar is dynamic...(I don't always want the last point of my indicator to be the last bar)

profile picture

superticker

#5
QUOTE:
I ... need to eyeball when I want to calculate my indicator on the chart, pick the begin and end dates on the chart
What you're describing is an oscillator indicator, which automatically repeats. There are a couple oscillator available in WL. To name a few:

QUOTE:
CMO (Chande Momentum Oscillator) is the (sum of the up-day prices) minus (sum of the down-day prices) normalized by the sum of all the prices for all days. It's scaled as a percentage.

UltimateOsc is an expontially weighted SMA over 28 days of normalized Buying Pressure (BP) or BP/TR, where BP is Close-Low, and TrueRange (TR) is High-Low. Oscillator ranges [0-100]. It is not weighted by volume and not a linear average like CMF is. It appears more responsive than a standard EMA. http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:ultimate_oscillator

UniversalOscillator good for identifying either swing or trend trading points. Smoothed line normalized between [1,-1].

QUOTE:
I don't always want the last point of my indicator to be the last bar.
So you're not trading off the WL Alerts and Signals created by the last bar on the chart? Obviously, we don't understand what's triggering your trades if it's not the Alerts. You can annotate specific bars on an oscillator (say following each oscillation) with AnnotateChart().

Perhaps you can start a new topic and explain how you're actually trying to trade if it's not from the last bar. (Normally, with WL, you're trying to use the latest bar to make your trading decisions.)

If you're trying to determine bracketing limits for Fibonacci trading lines, WL has some interactive drawing tools for doing that. But that's another topic, and I haven't used them.
profile picture

Eugene

#6
+1 for starting a new topic for this has apparently exhausted itself.
profile picture

kelvinyip

#7
ok ok... will make a new topic... I am trying to do anchored vwap. Have to eyeball the starting point of the average... like recent low. It is sort of like Fibonacci but I figure that custom drawing tool must require compiling code in C# and I don't want to do that.. nor do I know how to work all that visual studio nowadays..
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).