Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 00:24:13 +0000



Post From: Using an external Library

[2023-10-13 15:21:31]
DayTraderEsad - Posts: 121
Here is jsut a quick example on what I mean --- I didnt add the entire study, but this is how I have all of mine start

#include "sierrachart.h"
SCDLLName("Custom Close Study");

SCSFExport scsf_MidpointMomentumShift(SCStudyInterfaceRef sc)
{
if (sc.SetDefaults)
{
// Set default study settings here.
sc.GraphName = "Midpoint Momentum Shift";
sc.StudyDescription =
"The Midpoint Momentum Shift study identifies potential shifts in market momentum by comparing the close of a bar with the midpoint of both the current and previous bars."
"<p>"
"1. **Green Arrow (Original Condition)**: This plots below the price bar when the previous bar's close is below its midpoint and the current bar's close is above its midpoint. This might suggest a positive momentum shift."
"<p>"
"2. **Red Arrow (Opposite Condition)**: This plots above the price bar when the previous bar's close is above its midpoint and the current bar's close is below its midpoint, suggesting a potential negative momentum shift."
"<p>"
"The study allows for adjustments in the arrow's distance from the bars through tick offsets, making it adaptable to various chart resolutions and preferences.";

sc.GraphRegion = 0; // Same region as price chart
sc.ValueFormat = 0;

sc.Subgraph[0].Name = "Original Condition";
sc.Subgraph[0].DrawStyle = DRAWSTYLE_TRIANGLE_UP;
sc.Subgraph[0].PrimaryColor = RGB(0, 78, 155); // Green for original condition
sc.Subgraph[0].LineWidth = 3; // Adjust as needed for visibility

sc.Subgraph[1].Name = "Opposite Condition";
sc.Subgraph[1].DrawStyle = DRAWSTYLE_TRIANGLE_DOWN;
sc.Subgraph[1].PrimaryColor = RGB(128, 0, 0); // Red for opposite condition
sc.Subgraph[1].LineWidth = 3; // Adjust as needed for visibility

// Add input settings for tick offsets
sc.Input[0].Name = "Original Condition Tick Offset";
sc.Input[0].SetInt(10); // Default value
sc.Input[0].SetIntLimits(1, 100); // You can adjust the limits as necessary

sc.Input[1].Name = "Opposite Condition Tick Offset";
sc.Input[1].SetInt(10); // Default value
sc.Input[1].SetIntLimits(1, 100); // You can adjust the limits as necessary

sc.AutoLoop = 1; // Automatic looping through bars
return;
}