I'm trying to average into a trade that is simulating an intraday trade with daily bars. I have 3 price points to enter and i'm effectively averaging down. I also want to only take at a maximum of 10 trades, not counting the averaging down, even though I might have many more stocks that I could enter. So the only way that I could figure out is to use the following code:
// get the average price based on the low of the stock BuyPrice = IIf(trigger8, (triggerprice * 1 + Lmt_price7 * 1 + Lmt_price8 * 1)/3, If(trigger7, (triggerprice * 1 + Lmt_price7 * 1)/ 2, Lmt_price )); // increase the number of shares based on how many time we average down PositionSize = IIf(trigger8, -9, IIf(trigger7, -6, -3 )); This code get the correct entry price and the correct number of shares, i.e. up to 3 times as many shares but because i'm changing the PositionSize variable I have lost control over limiting the maximum number of stocks to trade to 10. I also want to use a percentage of the available equity so as the profit increase I will buy more shares. I've played around with sigscalein and looked at the examples provided but they are different in that they seem to all using the Closing price for the extra entries and are entering the stocks on multiple days, not the same day. I haven't been able to get anything to work with sigscalein. Any ideas? I really stuck at this point. Thanks, Mark