Login Page - Create Account

Support Board


Date/Time: Mon, 06 May 2024 17:37:28 +0000



Post From: ACSIL - trailing stop loss and orders

[2019-09-17 13:20:06]
MattK - Posts: 42
Ooooh. That's true! I wanted to make it happen only once when the previous bar had closed.

Sorry if I ask stupid questions, I'm still new at this.

I tried adding this piece with the LastIndexProcessed to only run it once on this index:

// Keep the last processed index in a persistent variable
  int Index =sc.Index;
  int& LastIndexProcessed = sc.GetPersistentInt(3);
  
  // Data processing once the bar has closed.
  if(sc.GetBarHasClosedStatus(Index-1)==BHCS_BAR_HAS_CLOSED && Index > LastIndexProcessed)
{
// Update the last processed index so the data is not processed again on this bar
    LastIndexProcessed = Index;
}
  {

Thanks for all your help.
Best,
Matt
Date Time Of Last Edit: 2019-09-17 13:25:50