Buy Tuesday Sell Thursday Backtesting Strategy?

cheual

cheual

New member
I'm trying to write a simple script that will buy Tuesday's open and sells Thursday's open. Then run the backtest to see what are the results. Oddly it is not work with my code below.

Am I missing something in this code? I'm using a 1M:1Day aggregation chart.

def begin = open(period = GetDayOfWeek(2));
def end = open(period = GetDayOfWeek(4));

#Backtesting
# Bullish Orders
AddOrder(OrderType.BUY_TO_OPEN, condition = begin, price = open, 1, tickcolor = Color.WHITE, arrowcolor = Color.WHITE, name = "BUY "+open);
AddOrder(OrderType.SELL_TO_CLOSE, condition = end, price = close, 1, tickcolor = Color.WHITE, arrowcolor = Color.WHITE, name = "SELL "+close);
 

Similar threads

Top