I don't see anything necessarily wrong with this code.
We'll need the debugging information from prints and TraceOrders to say for certain what is going on with the script. As mentioned, in particular you should make sure to print out the values of the bar size and of the bars being compared. Then you can see if these bar sizes are actually 4x as large.
In the strategy add prints (outside of any conditions) that print the date time of the bar and all values compared in every condition that places an order. You could print out the index of the bar, the size of the bar being compared, and the size of the current bar.
The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very important to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.
Further, enable TraceOrders which will let us know if any orders are being ignored and not being submitted when the condition to place the orders is evaluating as true.
Please let me know if I may further assist with analyzing the output or if you need any assistance creating a print or enabling TraceOrders.
Comment