NinjaTrader 8 Strategy help! - Versión para impresión +- Forum PipFlow (https://pipflow.com/forum) +-- Foro: Platforms and Indicators (https://pipflow.com/forum/Forum-Platforms-and-Indicators) +--- Foro: NinjaTrader 8 (https://pipflow.com/forum/Forum-NinjaTrader-8) +--- Tema: NinjaTrader 8 Strategy help! (/Thread-NinjaTrader-8-Strategy-help) |
NinjaTrader 8 Strategy help! - xnick - 01-08-2019 Hey, I need a simple strategy code temple that I can add more conditions to, so please add notes in the code where needed. Right now I have this code. if (CrossBelow(Close,ParabolicSAR1,1)) {EnterShort(Convert.ToInt32(DefaultQuantity), "");} // Set 2 if (BarsSinceEntryExecution()==4) {ExitShort(Convert.ToInt32(DefaultQuantity), "", "");} Which I add the conditions I want, then when they are met it opens a position, then 4 bars have passed it closes the position. I need it to close the positions on 5 minute intervals instead of 4 bars have passed. So if the order was opened at 2:20 it closes at 2:25, if opened at 2:21 it closes at 2:25, if opened at 2:27 it closes at 2:30, if opened at 2:29 it closes at 2:30, and so on and so on. RE: NinjaTrader 8 Strategy help! - waldo - 01-09-2019 Just replace if (BarsSinceEntryExecution()==4) with something like this just change to 5 min instead of 20 https://stackoverflow.com/questions/7701151/date-comparison-how-to-check-if-20-minutes-have-passed You should convert your start time to a UTC time, say 'start'. You can now compare your start time to the current UTC time using: start.AddMinutes(20) > DateTime.UtcNow |