Momentum Rotation
Momentum Rotation is a strategy that trades EURUSD, GBPUSD, USDJPY and AUDUSD on 4-hour bars. It holds at most 1 open trade.
several markets
strategy "Momentum Rotation"markets: EURUSD, GBPUSD, USDJPY, AUDUSDbars: 4hmax_open: 1input lookback = 30input threshold = 2%when bar.confirmed and trades.open(tag: "rotation").len == 0:for s in [EURUSD, GBPUSD, USDJPY, AUDUSD]:if roc(close_of(s), lookback) > threshold:buy market: s, risk: 0.5%, stop: 30 pips, target: 2R, tag: "rotation"breakwhen trades.open(tag: "rotation").len > 0 and roc(close, lookback) < 0:close_all tag: "rotation"Momentum Rotation is a strategy that trades EURUSD, GBPUSD, USDJPY and AUDUSD on 4-hour bars. It holds at most 1 open trade.
You can change 2 inputs: lookback (default 30) and threshold (default 2%).
When the bar has closed and the number of open trades tagged "rotation" is 0, it goes through each s in EURUSD, GBPUSD, USDJPY and AUDUSD and checks whether the rate of change of the close of s over lookback bars is above threshold and, if so, buys s at market, risking 0.5% of the balance, with a stop 30 pips from the entry, with a target 2R from the entry and tagged "rotation"; it also stops the loop.
When the number of open trades tagged "rotation" is above 0 and the rate of change over lookback bars is below 0, it closes all trades tagged "rotation".