- Home
- Forum
- cTrader News & Announcements
- Drawing lines from robots and indicators
Drawing lines from robots and indicators
- ← Previous
- 1
- 2
- 3 (current)
- 4
- Next →
Drawing lines from robots and indicators
magforex said:
cAlgo_Fanatic said:
Daily High and Low Indicator. Displays horizontal lines that correspond to the daily high and low.
Source Code:
using System; using cAlgo.API; namespace cAlgo.Indicators { [Indicator(IsOverlay = true)] public class DailyHighLow : Indicator { public override void Calculate(int index) { DateTime today = MarketSeries.OpenTime[index].Date; DateTime tomorrow = today.AddDays(1); double high = MarketSeries.High.LastValue; double low = MarketSeries.Low.LastValue; for (int i = MarketSeries.Close.Count - 1; i > 0; i--) { if (MarketSeries.OpenTime[i].Date < today) break; high = Math.Max(high, MarketSeries.High[i]); low = Math.Min(low, MarketSeries.Low[i]); } ChartObjects.DrawLine("high " + today, today, high, tomorrow, high, Colors.Pink); ChartObjects.DrawLine("low " + today, today, low, tomorrow, low, Colors.Pink); } } }
Hi Spotware, how do I control if I only want the current day or maybe only 2 days high and low only? Can you give me a hint? thanks!
for (int i = MarketSeries.Close.Count - 1; i > 0; i--) { if (MarketSeries.OpenTime[i].Date < today) break; high = Math.Max(high, MarketSeries.High[i]); low = Math.Min(low, MarketSeries.Low[i]); }
In this case 'int i = MarketSeries.Close.Count - 1' defines a number of iritations that equals all 'close' values found on chart = back to the beginning of available chart data. So, setting this to i.e. 2 would do.
I guess. Have not tried.
Simon
Why is it that if I draw objects from a custom indicator they do show up on the chart, but when drawing them from a robot they don't? I tied to run the robot in a backtest as well as on a live chart.
RE:
2. Horizontal line:ChartObjects.DrawHorizontalLine(objectName, y, color, [optional] thickness, [optional] style)
How to set the color:
Color FromArgb( int alpha, int red, int green, int blue) ?
First of all I am interested in transparency - int alpha.
I can draw a band msdn "StripLine Class"?
I want to develop an indicator for cTrader:
This can be done on cAlgo?
Sorry for my English is not Oxford.
Извините за мой слегка шершавый английский. Поэтому если что - то можно по русски.
RE: RE:
Vitali Gajdabrus said:
How to set the color:Color FromArgb( int alpha, int red, int green, int blue) ?First of all I am interested in transparency - int alpha.
I can draw a band msdn "StripLine Class"?
I want to develop an indicator for cTrader:
This can be done on cAlgo?
Can I get the coordinates of the cursor in the processing of events MouseClick, MouseDoubleClick, MouseDown, MoseLeave, MuseTove, the MouseUp, and the like to the program trading robots draw on the chart.
RE: RE: RE:
Can I get the coordinates of the cursor in the processing of events MouseClick, MouseDoubleClick, MouseDown, MoseLeave, MuseTove, the MouseUp, and the like to the program trading robots draw on the chart.
On the issue of transparency, color and found the answer. Please excuse me for my carelessness.
Interested in response to the second question.
RE: RE: RE: RE:
Vitali Gajdabrus said:
Can I get the coordinates of the cursor in the processing of events MouseClick, MouseDoubleClick, MouseDown, MoseLeave, MuseTove, the MouseUp, and the like to the program trading robots draw on the chart.
Regrettable very poor support cAlgo... :(
RE: RE: RE: test
akhizhniy said:
Vitali Gajdabrus said:
test
test
RE:
hi is there a way to highlight the corresponding whole number???
so it will look like this cAlgo_Fanatic said:
Indicator showing Round Numbers based on input step pips calculated between the chart High and Low.
Source Code:
using System; using cAlgo.API; namespace cAlgo.Indicators { [Indicator(IsOverlay = true)] public class RoundNumbers : Indicator { [Parameter(DefaultValue = 100)] public int StepPips { get; set; } protected override void Initialize() { double max = MarketSeries.High.Maximum(MarketSeries.High.Count); double min = MarketSeries.Low.Minimum(MarketSeries.Low.Count); double step = Symbol.PipSize*StepPips; double start = Math.Floor(min/step)*step; for (double level = start; level <= max + step; level += step) { ChartObjects.DrawHorizontalLine("line_" + level, level, Colors.Gray); } } public override void Calculate(int index) { } } }
RE: RE:
I'm looking for this highlight as well. Is there any property for this? Even if its not related to the lines will do.
Or maybe some tooltips?
Thanks.
johnreygalax8 said:
hi is there a way to highlight the corresponding whole number???
so it will look like this
cAlgo_Fanatic said:
Indicator showing Round Numbers based on input step pips calculated between the chart High and Low.
Source Code:
using System; using cAlgo.API; namespace cAlgo.Indicators { [Indicator(IsOverlay = true)] public class RoundNumbers : Indicator { [Parameter(DefaultValue = 100)] public int StepPips { get; set; } protected override void Initialize() { double max = MarketSeries.High.Maximum(MarketSeries.High.Count); double min = MarketSeries.Low.Minimum(MarketSeries.Low.Count); double step = Symbol.PipSize*StepPips; double start = Math.Floor(min/step)*step; for (double level = start; level <= max + step; level += step) { ChartObjects.DrawHorizontalLine("line_" + level, level, Colors.Gray); } } public override void Calculate(int index) { } } }
- ← Previous
- 1
- 2
- 3 (current)
- 4
- Next →