hi.
is it possible to use custom fitness value on portfolio trader of 10 instruments?
for example.. if i use averagetrade/mdd as my custom fitness value,
and try to get that value based on all 10 instruments trades, not based on each single instrument,
is it possible?
custom fitness value on portfolio of multiple instruments?
- Svetlana MultiCharts
- Posts: 645
- Joined: 19 Oct 2017
- Has thanked: 3 times
- Been thanked: 163 times
Re: custom fitness value on portfolio of multiple instruments?
Hello, rokanten,
Yes, it is possible.
If you set the custom criterion for optimization in your script – then the calculation is performed according to your script logic.
If you calculate the custom criteria in Java-script in Portfolio optimization settings -> Fitness Function window (see screenshot) – the value is based on all instruments of your portfolio. The set of values supported in Portfolio optimization is provided in that window.
Yes, it is possible.
If you set the custom criterion for optimization in your script – then the calculation is performed according to your script logic.
If you calculate the custom criteria in Java-script in Portfolio optimization settings -> Fitness Function window (see screenshot) – the value is based on all instruments of your portfolio. The set of values supported in Portfolio optimization is provided in that window.
Re: custom fitness value on portfolio of multiple instruments?
can i use my own proprietary code like monthly return of my strategy on Fitness Function window?
or can i use only reserved words?
or can i use only reserved words?
- Svetlana MultiCharts
- Posts: 645
- Joined: 19 Oct 2017
- Has thanked: 3 times
- Been thanked: 163 times
Re: custom fitness value on portfolio of multiple instruments?
In order to set the custom criterion for optimization in your script please use SetCustomFitnessValue keyword:
https://www.multicharts.com/trading-sof ... tnessValue
To apply it in the Optimization window please select Standard Criteria radio button and select Custom Fitness Value from the dropdown list.
https://www.multicharts.com/trading-sof ... tnessValue
To apply it in the Optimization window please select Standard Criteria radio button and select Custom Fitness Value from the dropdown list.
Re: custom fitness value on portfolio of multiple instruments?
i think it's not possible for multi instruments.
for example, custom fitness value as standard deviation of monthly return,
ES 200 300 400
6E -100 200 -300
then what i need is stdev(200,300,400,-100,200,-300)
and it seems what i get is stdev(200,300,400) and stdev(-100,200,300) seperately.
for example, custom fitness value as standard deviation of monthly return,
ES 200 300 400
6E -100 200 -300
then what i need is stdev(200,300,400,-100,200,-300)
and it seems what i get is stdev(200,300,400) and stdev(-100,200,300) seperately.
- Svetlana MultiCharts
- Posts: 645
- Joined: 19 Oct 2017
- Has thanked: 3 times
- Been thanked: 163 times
Re: custom fitness value on portfolio of multiple instruments?
It is required to use the values which are accessible from PowerLanguage.
It is not quite clear from your description what you would like to achieve. Would you mind to provide more details?
It is not quite clear from your description what you would like to achieve. Would you mind to provide more details?
Re: custom fitness value on portfolio of multiple instruments?
ok here it is, simplified,
array:list[10000](0);
var: stdarray(0)...... many var....;
totps=totaltrades;
mp=marketposition;
date0=month(date);
date1=month(date[1]);
symstr=getsymbolname;
(setting starting point for each symbol in array)
if symstr="A6" then smonths=335*0;
if symstr="AP" then smonths=335*1;
if symstr="B6" then smonths=335*2;
{calculate trade profit/loss)
if totps>totps[1] then begin
prof=positionprofit(1)
cumprof=cumprof+prof;
end;
(calculate monthly profit)
if date0<>date1 then begin
if mp<>0 then begin
monthprofit=cumprof
+{open profit}openpositionprofit
end
else begin
monthprofit=cumprof;
end;
deltamonthprofit=monthprofit-monthprofit[1];
if months=0 then months=smonths+1 else months=months+1;
list[months]=round(deltamonthprofit,2);
end;
(setting custom fitness value)
if lastbaronchart then begin
stdarray=StandardDevArray(list,10000,0);
SetCustomFitnessValue(stdarray);
end;
---------------------------------------------------------------------------------------
what i get is std of each symbol's result, not whole symbol.
i understand that, because array can't get results data from other symbols,
i mean.. if portfolio trader moves from one symbol to another symbol,
then that array is being reset, not carrying previous results.
i thought i can be done if i use custum fitness value, but not.
i actually do some excel work for this,
but it's convenient if i can get what i want throught your script, right?
array:list[10000](0);
var: stdarray(0)...... many var....;
totps=totaltrades;
mp=marketposition;
date0=month(date);
date1=month(date[1]);
symstr=getsymbolname;
(setting starting point for each symbol in array)
if symstr="A6" then smonths=335*0;
if symstr="AP" then smonths=335*1;
if symstr="B6" then smonths=335*2;
{calculate trade profit/loss)
if totps>totps[1] then begin
prof=positionprofit(1)
cumprof=cumprof+prof;
end;
(calculate monthly profit)
if date0<>date1 then begin
if mp<>0 then begin
monthprofit=cumprof
+{open profit}openpositionprofit
end
else begin
monthprofit=cumprof;
end;
deltamonthprofit=monthprofit-monthprofit[1];
if months=0 then months=smonths+1 else months=months+1;
list[months]=round(deltamonthprofit,2);
end;
(setting custom fitness value)
if lastbaronchart then begin
stdarray=StandardDevArray(list,10000,0);
SetCustomFitnessValue(stdarray);
end;
---------------------------------------------------------------------------------------
what i get is std of each symbol's result, not whole symbol.
i understand that, because array can't get results data from other symbols,
i mean.. if portfolio trader moves from one symbol to another symbol,
then that array is being reset, not carrying previous results.
i thought i can be done if i use custum fitness value, but not.
i actually do some excel work for this,
but it's convenient if i can get what i want throught your script, right?
- Svetlana MultiCharts
- Posts: 645
- Joined: 19 Oct 2017
- Has thanked: 3 times
- Been thanked: 163 times
Re: custom fitness value on portfolio of multiple instruments?
In Portfolio Trader it is possible to apply Money Management (MM) signal where you can get data from other signals and calculate the deviation in it. You can find MM signal examples in this article:
https://www.multicharts.com/trading-sof ... y_Examples
https://www.multicharts.com/trading-sof ... y_Examples