Nightshark Momentum strategy

Nightshark Momentum strategy

TLDR: Strategy is when there is 3 consecutive higher closing green candles then BUY, close position if there is $50 profit or $10 loss and repeat the process. Tried it on paper money.

Context:

Here in TD Ameritrade's "Ondemand" feature and Active traders section to trade EUR/USD with this momentum scalping strategy with this trading bot using Nightshark:

0:00
/

Nightshark setup:

Source Code:

      loop {
        read_areas()
        if (toNumber(area[1]) > 0)
          break
      }
      sleep 10000
      Click(point.a)
      Sleep 1000
      
      loop {
        read_areas()
        if (toNumber(area[2]) > 50 || toNumber(area[2]) < -30)
          break
      }
    
      Click(point.b)
      Sleep 5000

        loop {
        read_areas()
        if (toNumber(area[3]) > 500 || toNumber(area[3]) < -300)
          ExitApp
        else 
           break 
      }
    
    }  ```

Code Explanation:

Note: The original code had 

Thinkorswim Momentum custom study code:

# Define the conditions
def GreenCandle = close > open;
def HigherClose = close > close[1];

# Check if there are three consecutive green candles with higher closing
def isMomentum = GreenCandle and HigherClose and GreenCandle[1] and HigherClose[1] and GreenCandle[2] and HigherClose[2];

# Suppress arrows for next five candles after the signal
rec isMomentumPrev = if isMomentum[1] and !isMomentum[2] then 5 else if isMomentumPrev[1] > 0 then isMomentumPrev[1] - 1 else 0;

def signal = isMomentum and isMomentumPrev == 0;

# Add separate labels
AddLabel(yes, "isMomentum", if signal then Color.GREEN else Color.RED);
AddLabel(yes, if signal then "        1  " else "        0  ", if signal then Color.GREEN else Color.RED);

# Plot an arrow at the close of the three green candles
plot ArrowUp = if signal then low - tickSize() else Double.NaN;
ArrowUp.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
ArrowUp.SetLineWeight(3);
ArrowUp.SetDefaultColor(Color.GREEN);