however i want to manage a trade window inside this so i can programatically change it.
this is my logic. appreciate input if i missed something.
private bool TradeWithinTimeframe()
{
DateTime currTime=currentTime();
bool goTrade=false;
if(currTime.Hour>1 && currTime.Hour<15)
{
goTrade=true;
}
else
{
// close open positions.
if Position.MarketPosition != MarketPosition.Flat){
Position.Close();
}
// cancel open orders
Position.Account.CancelAllOrders(this.Instrument);
}
return goTrade;
}

Comment