Should this code work? I am trying to create a code in my strategy with a multi time frame with the secondary time frame being 1 second so that it can count how many times the price hit the target during the main bar for each second. So say it hit the target 20 times in the last 20 seconds without filling the strategy moves the profit target from 2 ticks to 1 tick or even breakeven. Do I have it right or am I even close? I tried to make the Close [1][0] like that but it wouldn't allow it so I was hoping that if I used the BarsInProgress==1 it would use seconds instead of the main timeframe of say 1 minute. It's a bit hard to backtest so I wanted to know if I am even close before I try to figure the testing part out. Thank you for any help.
if (BarsInProgress == 1)
{
if (Close[0] == Position.AvgPrice +2 * TickSize)
{
TargetTouch = TargetTouch +1;
}
if (TargetTouch >= 20)
{
SetProfitTarget("Long 1a", CalculationMode.Price, Position.AvgPrice +1 * TickSize);
}
}
Comment