Defparam cumulateorders = False Timeframe(daily,updateonclose) //Pause Trading After Volatility Spike once PauseTrading = 0 ADXRV = ADXR[40] If Average[40](ADXRV) >= Average[60](ADXRV) Then PauseTrading = 1 Else PauseTrading = 0 EndIf Timeframe(default) NoTradebefore = 21//(21 EURAUD) if hour >= NoTradebefore and PauseTrading = 0 Then possize = 1 Else possize = 0 Endif WeekendLongs = 1 //Enable [1] or Disable [0] holding of long position over weekends WeekendShorts = 1 //Enable [1] or Disable [0] holding of short position over weekends If dayofweek > 5 or (dayofweek = 5 and hour >= 23) Then If WeekendLongs = 0 Then If longonmarket Then Sell at market EndIf WeekendLongs = 1 EndIf If WeekendShorts = 0 Then If shortonmarket Then Exitshort at market EndIf WeekendShorts = 1 EndIf Else WeekendLongs = 0 WeekendShorts = 0 EndIf SampleSize = 10 LRDev = 0.2 LR = LinearRegression[SampleSize](TotalPrice) LRHigh = LR+LRDev*STD[SampleSize](LR) LRLow = LR-LRDev*STD[SampleSize](LR) RSI2 = RSI[2](close) If WeekendLongs = 0 and TotalPrice < LRLow and RSI2 <= 5 Then Buy possize contract at market Elsif WeekendShorts = 0 and TotalPrice > LRHigh and RSI2 >= 90 Then Sellshort possize contract at market EndIf If longonmarket and RSI2 >= 95 Then Sell at market ElsIf shortonmarket and RSI2 <= 5 Then Exitshort at market EndIf