I am trying to create a signal (strategy) that is based on relative strength. I will use it in Portfolio Trader. I want the signal to compare the 100-day price change in several stocks (data 1) with the 100-day price change in an index (data 2). I want the signal to buy the five most relatively strong stocks if they meet some additional criteria.
I have read the following page (https://www.multicharts.com/trading-sof ... y_Examples) many times but I don’t find it helpful enough.
I have these questions:
1. What does the word “Traceoutput(true)” mean? This word is included in the “Rotation Strategy”.
2. What does the word “pmm_set_my_named_num” mean? This word is also included in the “Rotation Strategy”.
I have tried to code my signal and this is what I came up with (I have excluded the additional criteria):
Code: Select all
inputs: Formula ((Close of Data1 / Close[100] of Data1) - (Close of Data2 / Close[100] of Data2) / (Close of Data2 / Close[100] of Data2)) , TraceOutput(true);
variables: BarNumber (0), BarNumber2 (0), RelativeStrength (0);
BarNumber = BarNumber of data(1);
BarNumber2 = BarNumber of data(2) ;
RelativeStrength = Formula ;
if BarNumber > BarNumber[1] and BarNumber2 > BarNnumber2[1] then begin
pmm_set_my_named_num("Relative Strentgth", RelativeStrength);
end;
if (TraceOutput=true) then begin
buy this bar on close;
end;