Login Page - Create Account

Support Board


Date/Time: Wed, 07 May 2025 16:17:53 +0000



Post From: Beginner ACSIL help please

[2024-11-26 23:57:42]
User745789 - Posts: 377
Thank you User431178! I'll be in touch to get your email address to send the Amazon gift voucher. I was experimenting with things close to your solution, but doubt I would have gotten there by trial and error. There is very little in the documentation to help, and I could not find any example code to mimic. These two lines don't really have any meaning to me. But the rest makes sense.


s_SCPositionData PositionData;
sc.GetTradePosition(PositionData);

It was Frozen Tundra's youtube content that got me as far as I have. With some help for the forum I now have a working trading system with 88 lines of code. All I need to do now is add the trigger to move stoploss to breakeven and it is finished.

Edit, my move to breakeven doesn't work when the trigger is hit. I got the example code from tradingsystem.cpp that ships with SC. Any hints?

//Move SL to BE
  s_SCNewOrder NewOrder;
  NewOrder.MoveToBreakEven.Type = MOVETO_BE_ACTION_TYPE_OCO_GROUP_TRIGGERED;
  NewOrder.MoveToBreakEven.TriggerOffsetInTicks = 10;
  NewOrder.MoveToBreakEven.BreakEvenLevelOffsetInTicks = 0;
  NewOrder.MoveToBreakEven.TriggerOCOGroup= OCO_GROUP_1;

Another piece of example code in the same script is as follows. But that doesnt move the SL either

    // This is a common setting and applies to all Stop Attached Orders set on the main order.
      NewOrder.MoveToBreakEven.Type=MOVETO_BE_ACTION_TYPE_OFFSET_TRIGGERED;

      //After 5 ticks of profit, the stop order will be moved to breakeven
      NewOrder.MoveToBreakEven.TriggerOffsetInTicks= 5;
      NewOrder.MoveToBreakEven.BreakEvenLevelOffsetInTicks= 0;

Perhaps the location of the breakeven code is wrong. Though I have it outside the if statement that controls entry of positions. So it seems ok to me.

ps, I have started a 50 hour online intro to C++ course. It is quite good so far.
Date Time Of Last Edit: 2024-11-27 01:34:16