Login Page - Create Account

Support Board


Date/Time: Mon, 16 Sep 2024 19:05:11 +0000



Post From: how to create automated Exit which is based on my Stoploss

[2022-07-16 21:36:46]
artmaan - Posts: 23
i am trying to make a simple study which shows me the value of the attached stop order in a subgraph,then i can use this in spreadsheets, but i am not sure how to do it.

i tried for test purpose to show me avgfillprice with SCPositionData in a subgraph this way and it worked like i wanted:

//Get Position data for the symbol that this trading study is applied to.
s_SCPositionData PositionData;
int Result = sc.GetTradePosition(PositionData);
float AvgPrice = PositionData.AveragePrice;//Access the AveragePrice

sc.Subgraph[0][sc.Index] = static_cast<float>(AvgPrice);


then i tried to get the the attached stoporder with sc.GetNearestStopOrder() and StopChildInternalOrderID the same way as above, but it didnt work.

s_SCTradeOrder TradeOrder;
int GetNearestStopOrder(s_SCTradeOrder & OrderDetails);
int Result = sc.GetNearestStopOrder(TradeOrder);
float Stopprice= TradeOrder.StopChildInternalOrderID ;

sc.Subgraph[0][sc.Index] = static_cast<float>(Stopprice);


i have tried to learn from the examples in tradingsystem.cpp and other, but couldnt find a solution for my simple study yet.

can you tell me please what the best way would be to access the price of the attached stoporder in ascil?

thank you