#!/bin/bash
echo "THIS IS THE PRODUCTION FILE FOR MGSHMOMENTUM"
echo "THIS MODEL STARTS TRADING 03/31/2025"
echo "RUNMGSHMOMENTUM MODE{DAILY|MONTHLY} TRADEDATE"

if [ -z "$1" ] || [ -z "$2" ]; then
  echo "MISSING PARAMETERS, PLEASE TRY AGAIN."
else
  MODE="${1^^}"
  TRADEDATE=$2
  SESSIONFILE=/home/pi/ARM64/MarketData/MarketData/Models/MGSH20250331.TXT
  echo "RUNMGSHMOMENTUM MODE:$MODE  TRADEDATE:$2"
  if [ "$MODE" == "DAILY" ];then
    echo "MK MGSHRUNDAILY /SESSIONFILE:$SESSIONFILE /TRADEDATE:$TRADEDATE"
    /home/pi/ARM64/MarketData/MarketData/bin/Debug/net8.0/mk MGSHRUNDAILY MGSHRUNDAILY /SESSIONFILE:"$SESSIONFILE" /TRADEDATE:"$TRADEDATE"
  else
    echo "ALWAYS RUN AT END OF MONTH"
    STOPLIMITRISKPERCENTDECIMAL=.20
    STARTDATE="03-31-2025"
    INITIALCASH=10000
    INITIALHEDGECASH=3000
    echo "MK MGSHRUNBACKTEST /STARTDATE:$STARTDATE /ENDDATE:$STARTDATE /KEEPSLOTPOSITIONS:TRUE /STOPLIMITRISKPERCENTDECIMAL:$STOPLIMITRISKPERCENTDECIMAL /USESTOPLIMITS:TRUE /INITIALHEDGECASH:$INITIALHEDGECASH /USEHEDGING:TRUE /USELOWSLOPEBETACHECK:TRUE /INCLUDETRADEMASTERFORSYMBOLSHELD:TRUE /MACDREJECTSTRONGSELLSIGNALS:FALSE /MACDREJECTWEAKSELLSIGNALS:TRUE /MAXPOSITIONS:3 /INITIALCASH:$INITIALCASH /HOLDINGPERIOD:3 /SESSIONFILE:$SESSIONFILE"
    /home/pi/ARM64/MarketData/MarketData/bin/Debug/net8.0/mk MGSHRUNBACKTEST /STARTDATE:"$STARTDATE" /ENDDATE:"$STARTDATE" /KEEPSLOTPOSITIONS:TRUE /STOPLIMITRISKPERCENTDECIMAL:"$STOPLIMITRISKPERCENTDECIMAL" /USESTOPLIMITS:TRUE /INITIALHEDGECASH:"$INITIALHEDGECASH" /USEHEDGING:TRUE /USELOWSLOPEBETACHECK:TRUE /INCLUDETRADEMASTERFORSYMBOLSHELD:TRUE /MACDREJECTSTRONGSELLSIGNALS:FALSE /MACDREJECTWEAKSELLSIGNALS:TRUE /MAXPOSITIONS:3 /INITIALCASH:"$INITIALCASH" /HOLDINGPERIOD:3 /SESSIONFILE:"$SESSIONFILE"
  fi
fi

