AbzParticipant
Veteran
Hello
is there any way to tell the strategies to not enter any trade on U.S. Nonfarm Payrolls this seems to occur first friday in every month.
IF OpenDay < 8 AND OpenDayOfWeek = 5 THEN
TradeOn = 0
ELSE
TradeOn = 1
ENDIF
From 1st through 7th each month there is just ONE friday, in that case the variable TRADEON will be cleared, set otherwise.
You have to add TradeOn to your conditions to open any trade.
This snippet works for intraday bars.
Hello,
I have also this kind of question.
Do you think it is possible to use CALL fonction to create a “remote control” of the code?
My idea is to modify the called indicator to say to indicate days on and day off. But I don’t know if a bot can’t take in account indicator modification. I didn’t test it.
Thanks
I tried this simple strategy with the indicator:
//-------------------------------------------------------------------------
// Codice principale : Il Mio Sistema-XXX
//-------------------------------------------------------------------------
defparam cumulateorders=false
if OnMarket THEN
SELL AT MARKET
endif
Cond = CALL "TradeOrNot"
IF Cond THEN
BUY AT MARKET
ENDIF
//-------------------------------------------------------------------------
// Funzione : TradeOrNot
//-------------------------------------------------------------------------
RETURN 0 //1=trade ON 0=trade OFF
My idea was to change the indicator, setting it either to 0 or 1 to allow/ban trading, but it seems indicators are now being embedded at launch time and used like regular functions in programming languages (this feature will make code faster and was long awaited) but you will have to stop your strategy and restart it from scratch after modifying the indicator, so it’s no use. You’ll have to modify dates embedded in your strategy.
As far as I know there are no alternatives, can @nicolas confirm indicators are now embedded in the strategy?
Thank you for the test, that’s exactly what I think about.
It would be interesting to do this another way for codes that need a learning period as neural networks.