- ago
Weight is an added feature in the Signal selection. How is it calculated? Is it used to determine the order in selecting signals? Is it used to determine which signals are NSF? Can we "modify" the weight based on other Values eg ADX>
0
1,317
8 Replies

Reply

Bookmark

Sort
- ago
#1
Please see Weight either in the QuickRef or in online manual:
https://www.wealth-lab.com/Support/ApiReference/Transaction
0
- ago
#2
If my C# code below does not explicitly assign transaction weights, ...

CODE:
   if (dxSmoothed[bar] < 37.0 && vossPredictorVelocityNorm[bar] > vossPredictVelNormThres[bar] //<33.5       && vossPredictorVelocity[bar] > vossPredictVelThres[bar]       && dxSmoothed[bar] > dxSmoothedThres[bar] //very predictive, but timing lagging       && mfoConsecUp[bar] > 0.0    {       Transaction t = PlaceTrade(bars, TransactionType.Buy, OrderType.Stop, bars.Close[bar], "Voss predictor buy");       t.SetPositionMetric("merit rank", dxSmoothedThres.MeritRank(bar));       //t.SetPositionMetric("Voss Predictor Velocity", vossPredictorVelocity[bar]);    }
... then how does WL assign these weights to the signal column below? Does it simply pick numbers at random for the weights? Or are these weights for something else entirely?
0
Glitch8
 ( 6.70% )
- ago
#3
Randomly
1
- ago
#4
Does this apply to NSF positions in MetaStrategies? I.e. if there are two signals but only enough funds for one trade available, does the system randomly chose between the two?
0
- ago
#5
QUOTE:
Does this apply to NSF positions in meta strategies?

It would have to apply to all trading, metastrategies included; otherwise, how could the metastrategy break the tie?

You can assign Weights yourself when you create the Transaction if you don't want WL to assign them randomly. For example, I have a local library routine I call to compute the Sharpe Ratio over the most recent 5 trades of a stock, and that gets assigned as a "Weight" if the trade is for the off-the-Chart bar. The reason for this assignment has nothing to do with trading priority. I simply want to see the most recent Sharpe Ratios (in the Weights column) on the Quotes window. (If I could define my own columns in the Quotes window, I wouldn't use Weights at all.)
0
- ago
#6
Thanks, Superticker.

Do you have some sample code you're willing to share on how to assign the weights? I'm managing this manually right now but it would be good to have the system make the decision.
0
- ago
#7
Well, the code I have is a "hack" to display Sharpe Ratios in the Weights column of the Quotes window. But you're not interested in a hack, right?

In the QuickRef, lookup Transaction. Scroll down to the Weight property and click on it. That should display a button to press to get a simple sample code assigning the weight. That's what you want.

If you want to see my "hacked" code, that's below. Notice I only assign a Weight for the (idx == bars.Count-1) bar, but for priority purposes, you would assign a Weight for all trades, not just the last off-the-Chart trade.
CODE:
   {       Transaction t = PlaceTrade(bars, TransactionType.Buy, OrderType.Stop, bars.Close[bar], "Voss predictor buy");       t.SetPositionMetric("merit rank", dxSmoothedThres.MeritRank(bar));       if (bar == bars.Count-1)       {          t.SetPositionMetric("sharpe ratio", sharpeRatioVal.LastBar(true));          t.Weight = sharpeRatioVal.LastBar();          t.SignalName = sharpeRatioVal.ConsecWins("0 ") + t.SignalName;          //WriteToDebugLog(sharpeRatioVal.LastBar());       }    }

Off topic, but the t.SetPositionMetric lets you add custom metrics to the Position objects so you can plot them with the Analysis Series performance visualizer, Position Metrics performance visualizer, or ScottPlot. Start a new topic if you have questions about that.
1
Cone8
 ( 3.17% )
- ago
#8
You can use any building block strategy and drag in the Transaction Weight condition to assign weights, then Open as C# Coded Strategy to see how it's done.

In the QuickRef, search for "Weight" for description and example.

The same example is right here on the website:
https://www.wealth-lab.com/Support/ApiReference/Transaction#Weight
1

Reply

Bookmark

Sort