Support Board
Date/Time: Sun, 24 Nov 2024 13:32:33 +0000
[Programming Help] - Help in a custom study code and function
View Count: 209
[2024-06-02 04:46:16] |
User862183 - Posts: 2 |
Hello everyone, I'm trying to create an indicator that shows me the ratio between passive orders (pulling/stacking) and aggressive orders at any given time. So I've started coding in acsil to do this Hello everyone, I'm trying to create an indicator that shows me the ratio between passive orders (pulling/stacking) and aggressive orders at any given time. So I've started coding in acsil to do this. Here's the code I have at the moment, although I've added two imaginary functions ( sc.GetOrderFlowPullingStackingData(index) and sc.GetOrderFlowAggressiveOrdersData(index)). One function for pulling stacking and the other for aggressive orders at time T. But I don't know the real sierra chart functions that do this. I need to replace them with the actual functions provided to get the passive and aggressive order data. But I don't know which ones it is. I don't know if you understand my problem and if you have a solution but it would help me a lot. Thank you for reading and for any help you can give me. here the code #include "sierrachart.h" SCDLLName("Pulling/Stacking vs Aggressive Orders") SCSFExport scsf_PullingStackingVsAggressiveOrders(SCStudyInterfaceRef sc) { SCSubgraphRef RatioLine = sc.Subgraph[0]; SCInputRef PullingStackingWindow = sc.Input[0]; SCInputRef AggressiveOrdersWindow = sc.Input[1]; if (sc.SetDefaults) { sc.GraphName = "Pulling/Stacking vs Aggressive Orders"; sc.StudyDescription = "Displays the ratio between pulling/stacking and aggressive orders."; RatioLine.Name = "Ratio"; RatioLine.DrawStyle = DRAWSTYLE_LINE; RatioLine.PrimaryColor = RGB(255, 0, 0); // Red PullingStackingWindow.Name = "Pulling/Stacking Window (seconds)"; PullingStackingWindow.SetInt(10); // Default window of 10 seconds AggressiveOrdersWindow.Name = "Aggressive Orders Window (seconds)"; AggressiveOrdersWindow.SetInt(10); // Default window of 10 seconds sc.AutoLoop = 1; // Automatically loop through the data return; } // Variables to store pulling/stacking and aggressive orders data float totalPullingStacking = 0.0; float totalAggressiveOrders = 0.0; // Get the current time index int currentTimeIndex = sc.Index; // Define the window size based on the input settings int pullingStackingWindowSize = PullingStackingWindow.GetInt() * sc.UpdateInterval; int aggressiveOrdersWindowSize = AggressiveOrdersWindow.GetInt() * sc.UpdateInterval; // Calculate pulling/stacking orders over the specified window for (int i = 0; i < pullingStackingWindowSize; ++i) { int index = currentTimeIndex - i; if (index < 0) break; // Hypothetical function to get pulling/stacking data totalPullingStacking += sc.GetOrderFlowPullingStackingData(index); // Replace with the actual function } // Calculate aggressive orders over the specified window for (int i = 0; i < aggressiveOrdersWindowSize; ++i) { int index = currentTimeIndex - i; if (index < 0) break; // Hypothetical function to get aggressive orders data totalAggressiveOrders += sc.GetOrderFlowAggressiveOrdersData(index); // Replace with the actual function } // Calculate the ratio float ratio = 0.0; if (totalAggressiveOrders != 0) { ratio = totalPullingStacking / totalAggressiveOrders; } // Set the calculated ratio to the subgraph RatioLine[sc.Index] = ratio; } Thank you for reading and for any help you can give me. |
To post a message in this thread, you need to log in with your Sierra Chart account: