- ago
I want to accept user input as parameters to plot additional symbols on a strategy chart. Since strategies only accept int and double parameters, is there an alternate method to gather the input? A text file would work, but not very elegant.

I suppose I could use a specific dataset rather than a text file.


Thanks,
TG


2
957
8 Replies

Reply

Bookmark

Sort
- ago
#1
Perhaps I don't understand the question. Why not simply accept an int input parameter such that a "0" means not to plot any symbols and a "1" means to go ahead and plot all the symbols? Keep it simple.

UPDATE: I thought you meant icon symbols (tangles, squares, stars), not strings of ticker symbols. You need to better clarify your question. So where are you going with this? You want to print (DrawText) a bunch of ticker mnemonics on the Chart? Are you intending on printing all the ticker mnemonics for the current DataSet on the Chart, or just certain ones?
0
- ago
#2
https://www.wealth-lab.com/Discussion/InputBox-6392
0
- ago
#3
QUOTE:
Perhaps I don't understand the question. Why not simply accept an int input parameter such that a "0" means not to plot any symbols and a "1" means to go ahead and plot all the symbols? Keep it simple.

UPDATE: I thought you meant icon symbols (tangles, squares, stars), not strings of ticker symbols. You need to better clarify your question. So where are you going with this? You want to print (DrawText) a bunch of ticker mnemonics on the Chart? Are you intending on printing all the ticker mnemonics for the current DataSet on the Chart, or just certain ones?


Thanks for the response. I want to plot multiple symbols and related information based on user input, not hard coded. In some cases it will be the entire dataset, in others it will not. I think I have a couple of options that will work in this case. For many reasons, it would be ideal if WL allowed additional parameter types with Strategies.


Thanks, Eugene. I'm running into exception issues with the linked approach, much like others in the thread. Anyway, I think I have a solution that will work for this case.
0
Glitch8
 ( 8.38% )
- ago
#4
We can flag this as a #FeatureRequest to get it into the development queue.
0
- ago
#5
QUOTE:
I want to plot multiple symbols and related information based on user input

If you want to plot multiple ticker symbols on the same pane, then you'll have to synchronize them first (with one symbol) so they all have the same x-axis values; otherwise, you'll get nothing. See BarHistorySynchronizer in the QuickRef.

I wouldn't plot more than 9 ticker symbols at a time on a pane; otherwise, you'll have a mess.

I would hard code as much as possible, but you can use different "Indicator Sets" to load and display specific sets of indicators.
0
- ago
#6
QUOTE:
We can flag this as a #FeatureRequest to get it into the development queue.


Adding String, Bool, and DateTime as strategy input options would be very nice.
1
Cone8
 ( 25.05% )
- ago
#7
QUOTE:
Adding String, Bool, and DateTime as strategy input options would be very nice.
Here's how -

CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Data; using WealthLab.Indicators; using System.Collections.Generic; namespace WealthScript123 { public class MyStrategy : UserStrategyBase {       public MyStrategy()       {          AddParameter("Boolean", ParameterType.Int32, 0, 0, 1, 1);          AddParameter("String", ParameterType.Int32, 0, 0, 4, 1);          AddParameter("Year", ParameterType.Int32, 2020, 1, 2030, 1);          AddParameter("Month", ParameterType.Int32, 1, 1, 12, 1);       }       public override void Initialize(BarHistory bars)       {          _enableit = Parameters[0].AsInt == 1;          _theString = _oneOf4[Parameters[1].AsInt];          _date = new DateTime(Parameters[2].AsInt, Parameters[3].AsInt, 1);          WriteToDebugLog("The boolean is " + _enableit);          WriteToDebugLog("The string is " + _theString);          WriteToDebugLog("The date is " + _date.ToShortDateString());        }     public override void Execute(BarHistory bars, int idx) { }       bool _enableit = false;       string _theString = "";       DateTime _date = DateTime.Now;       string[] _oneOf4 = { "Zero", "One", "Two", "Three", "Four" };    } }
0
- ago
#8
QUOTE:

Adding String, Bool, and DateTime as strategy input options would be very nice.

Yes, it would be nice to add these types of parameters. For example, in my task it is difficult to determine a list of string elements in the code. Well, entering the date using three different parameters does not look like an elegant solution.
0

Reply

Bookmark

Sort