I'm having trouble with the following, I have two signal providers to enter some long/short market orders.
I have a couple of questions
1 - For further development, I need to know if there's currently a position open due to SMA, Stoch, or both. It seems there's no way to find this, it doesn't help much-giving tags to these trades if I cannot track them, what options do I have?
2 - A sample screenshot is given, when there are 2 long trades going (quantity = 2), and I place an "EnterShort" (quantity = 1) these 2 trades are closed, and the short is entered. Is there a way to close just "quantity = 1"? and if I close "Stoch", "SMA" remains open, tracked, and visible on the chart? (vice versa if I close "SMA")
protected override void OnBarUpdate()
{
if (CurrentBar < BarsRequiredToTrade)
return;
if (CrossAbove(smaFast, smaSlow, 1))
EnterLong("SMA");
else if (CrossBelow(smaFast, smaSlow, 1))
EnterShort("SMA");
if (CrossAbove(stochastics.K, 20, 1))
EnterLong("Stoch");
else if (CrossBelow(stochastics.K, 80, 1))
EnterShort("Stoch");
}

Comment