1: I want my logic looking at 5M HA bars, but as soon as the current 5M bar closes {so is this [0]?} I want it to test the logic and send the order to the smaller (1Tick) TF, not wait for the next 5M bar to submit if you know what I mean.
2: I also want it to monitor the open position on the smaller TF and close it if XYZ, even if that 5M bar is not closed.
3: I do not want it taking more than 1 trade per 5M HA bar.
So I tried all kinds of goofy stuff, but the most recent problem is how do I place an order on the 1-Tick, but reference the 5M using BarsSinceLast****()? Because it will only reference the series the order was on right? So if I place orders on the 1-tick (Series 1) to get immediate fills, and only want 1 trade per the 5Min HA(Main Chart Series 0) then it doesn't catch it?
I also tried pulling the 5M HA into the script hard coded but could figure out how to store that into a BarsArray. AddHeikenAshi(?what goes here?, 5)...
Here is an example. This is just where I was at when I gave up, I have not added complete Advanced Order Handling yet:
//ADDING 1-TICK FOR ORDERS AND MANAGEMENT
else if (State == State.Configure)
{
AddDataSeries(BarsPeriodType.Tick, 1);
}
protected override void OnBarUpdate()
{
//LOGIC ON 5M HA, the main chart the strat is on
if (BarsInProgress == 0)
{
if (CurrentBars[0] < 2)
return;
// Set 1 Long Entry
if ((Position.MarketPosition == MarketPosition.Flat)
&& (ENTRY LOGIC)
&& ((BarsSinceEntryExecution(1,"Long",1) >= 1 ) || (BarsSinceEntryExecution(1,"",1) == -1 ))) //HOW CAN I MAKE IT REF THE 5M WHEN ORDER WAS ON SERIES 1?
{
EnterLong(1, Convert.ToInt32(DefaultQuantity), "Long");
}
}
//1-TICK TF FOR MONITORING
if (BarsInProgress == 1)
{
if (CurrentBars[1] < 50)
return;
//Set 3 Long Exit
if ((Position.MarketPosition == MarketPosition.Long)
&& (EXIT LOGIC))
{
ExitLong(1, Convert.ToInt32(DefaultQuantity), "Out", "Long");
}
}
I have been up and down using varibales to try and set whether a trade was taken on the 5-min bar, but nothing I have tried has worked.
Hopefully someone can point out something simple i am missing. If bringing in hard-coded HA 5M time-frame works better I would do that, but have not been able to make it work. So if you could answer how to hard-code a 5M HA data series as a bonus that would be awesome and teach me a lot. thank you.

Comment