Hi,
suppose i have a signal and i would like to apply a on/off criteria.
For example, trade just if Average(profitfactor,30)>profit factor (based on all trades).
Now i'm doing it manually with a excel file support.
Is it possible to incorporate this logic directly in a signal?
The problem is that is simple to stop a system if the condition above is not true any more.
But how to reactivete it if the system is not trading (so is not generating any order that can match again the reactivation of the signal?)
Any suggestion to work with?
I tought about working with a second system that works with input value of the main system.Any way to call system parameters of another trading system?
Thanks in advance
ON/OFF Auto of signal
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: ON/OFF Auto of signal
That is tricky, because if the signal does not generate trades, there is also no profit factor and therefore no way to know if the average profit factor is above a certain value.But how to reactivete it if the system is not trading (so is not generating any order that can match again the reactivation of the signal?)
You'd probably manually need to track the profit/loss of all potential trades and calculate the profit yourself.
Or (like you already mentioned) create a second signal that calculates the average profit factor. You could use global variables (search the forum for more) to pass information between both signals. There's no way to call the parameters/inputs from another signal directly.
Re: ON/OFF Auto of signal
Hi JoshM thanks for your answer .
The problem using global variables is that i can get just the last value for the last bar of the chart they are extracted.
Here an example :
declaring global variables and main trading system:
equity=netprofit;
equityMA= Average(equity,30);
if equity=equity[1] then
equityma=equityma[1];
if close>Average(close,250)then buy next bar at market;
if close<Average(close,250)then sell next bar at market;
GVSetNamedDouble("provaglobal",equity);
GVSetNamedDouble("provaglobal2",equityma);
Filtered system:
equity= GVGetNamedDouble("provaglobal",0);
equityMa= GVGetNamedDouble("provaglobal2",0);
if equity>equityma then begin
if close>Average(close,250)then buy next bar at market;
if close<Average(close,250)then sell next bar at market;
end;
//
If in the last bar of the main system i have equity>equityma, in the filtered system the condition is alway valid (because i have just the last bar gvariable values of the main system to work with)
This is a problem for see how filtered system works in the backtest.
The problem using global variables is that i can get just the last value for the last bar of the chart they are extracted.
Here an example :
declaring global variables and main trading system:
equity=netprofit;
equityMA= Average(equity,30);
if equity=equity[1] then
equityma=equityma[1];
if close>Average(close,250)then buy next bar at market;
if close<Average(close,250)then sell next bar at market;
GVSetNamedDouble("provaglobal",equity);
GVSetNamedDouble("provaglobal2",equityma);
Filtered system:
equity= GVGetNamedDouble("provaglobal",0);
equityMa= GVGetNamedDouble("provaglobal2",0);
if equity>equityma then begin
if close>Average(close,250)then buy next bar at market;
if close<Average(close,250)then sell next bar at market;
end;
//
If in the last bar of the main system i have equity>equityma, in the filtered system the condition is alway valid (because i have just the last bar gvariable values of the main system to work with)
This is a problem for see how filtered system works in the backtest.