Description
Example used in
using System;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo.Plugins
{
[Plugin(AccessRights = AccessRights.None)]
public class PreviousBarInfo : Plugin
{
Bars _bars;
Grid _grid;
TextBlock _lowBlock;
TextBlock _openBlock;
TextBlock _highBlock;
TextBlock _closeBlock;
protected override void OnStart()
{
var tradeWatchTab = TradeWatch.AddTab("Previous Bar Info");
tradeWatchTab.IsSelected = true;
var webView = new WebView();
tradeWatchTab.Child = webView;
webView.NavigateAsync("https://ctrader.com/");
_grid = new Grid(2, 2)
{
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
ShowGridLines = true,
Height = 150,
Width = 150,
};
_bars = MarketData.GetBars(TimeFrame.Minute, "USDJPY");
_lowBlock = new TextBlock
{
Text = "Low:" + _bars.LowPrices.LastValue,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
};
_highBlock = new TextBlock
{
Text = "High:" + _bars.HighPrices.LastValue,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
};
_closeBlock = new TextBlock
{
Text = "Close:" +_bars.ClosePrices.LastValue,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
};
_openBlock = new TextBlock
{
Text = "Open:" + _bars.OpenPrices.LastValue,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
};
_grid.AddChild(_lowBlock, 0, 0);
_grid.AddChild(_highBlock, 0, 1);
_grid.AddChild(_openBlock, 1, 0);
_grid.AddChild(_closeBlock, 1, 1);
tradeWatchTab.Child = _grid;
_bars.Tick += _bars_Tick;
}
private void _bars_Tick(BarsTickEventArgs obj)
{
_lowBlock.Text = "Low: " +_bars.LowPrices.LastValue.ToString();
_highBlock.Text = "High: " +_bars.HighPrices.LastValue.ToString();
_openBlock.Text = "Open: " +_bars.OpenPrices.LastValue.ToString();
_closeBlock.Text = "Close: " +_bars.ClosePrices.LastValue.ToString();
}
protected override void OnStop()
{
// Handle Plugin stop here
}
}
}
Spotware
Joined on 23.09.2013
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Previous Bar Info_withSourceCode.algo
- Rating: 0
- Installs: 348
- Modified: 14/06/2024 06:22
Note that publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section, please use the Copyright Infringement Notification form to submit a claim.
Comments
Log in to add a comment.
No comments found.