C
C#11mo ago
._ekb_.

Have any experience with trading indicators?

I'm trying to code some indicators for the Quantower platform in C#. Yes I started yesterday and yes I tried using Chatgpt to help. I don't know if anyone can help me but this is my code. It's not showing any errors in Visual Studio but just shows an empty window when I open it in the platform. Do you see anything obviously wrong with this, or why it won't display on my chart? I made a simpler one that worked fine. using System; using System.Drawing; using TradingPlatform.BusinessLayer; namespace VolumeCandle_test { public class Volume_Candle_test : Indicator { Indicator volume; Indicator ema; int emaPeriod = 26; // Default EMA period double thresholdPercentage = 10; // Default threshold percentage public Volume_Candle_test() : base() { Name = "VolumeCandle test"; AddLineSeries("line1", Color.CadetBlue, 1, LineStyle.Solid); SeparateWindow = true; } protected override void OnInit() { volume = Core.Indicators.BuiltIn.Volume(); AddIndicator(volume); ema = Core.Indicators.BuiltIn.EMA(emaPeriod, PriceType.Volume); AddIndicator(ema); } protected override void OnUpdate(UpdateArgs args) { double currentVolume = volume.GetValue(0); // Get current volume double emaValue = ema.GetValue(0); // Get current EMA value double threshold = emaValue * (thresholdPercentage / 100.0); // Calculate threshold value if (currentVolume > emaValue + threshold) { SetBarColor(Color.Red); // Set bar color to red if above threshold } else { SetBarColor(); // Reset bar color } } } }
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server