- ago
I need a daily OHLC daily indicator, even if trading with 1m or 5m charts, I need the lines of open, high, low, close of the day before. Additionally I need the overnight high and low line, I mean the high and low from 0 up to 9:30 am.

Is that possible?
0
158
3 Replies

Reply

Bookmark

Sort
- ago
#1
You could use the ScaleInd (transformer) indicator for this.
0
Cone8
 ( 3.17% )
- ago
#2
This isn't something that most users would want to see on ever intraday chart and can be accomplished with "everyday programming", so it's not a feature request (removed).

Simply review/open the QuickRef > BarHistoryCompressor > ToDaily, you'll get an example of how to do it. Open/run the example on intraday data.
- Like Eugene pointed out, a no-code equivalent for compressing series and indicators for Block Strategies is the ScaleInd Transformer indicator.

For the overnight high/low, see the PowerPack Indicator > PremarketHL. You'll need to turn off the Pre/Post Filter to use this indicator properly... which unfortunately for you will is likely to affect the other Compressed Daily values.

Hang on for the full solution...
0
Cone8
 ( 3.17% )
- ago
#3
Run on intraday data with the Pre/Post Filter DISABLED (unchecked).

Note!
Because this accesses Daily bars, not compressed intraday, the OHLC can differ somewhat from what the intraday data shows. For example, Daily bars of an official, settled closing price, which is often not the last full-lot trade before 4pm shown on an intraday chart.

CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using System.Drawing; using System.Collections.Generic; using WealthLab.PowerPack; namespace WealthScript2 {    public class BarHistoryToDailyScaleExample : UserStrategyBase    {       BarHistory _daily;       PremarketHL _preHi;       PremarketHL _preLo;       public override void Initialize(BarHistory bars)       {          if (!bars.IsIntraday)          {             throw new InvalidOperationException("Example is intended for an intraday BarHistory");          }          //get the regular-session daily bars directly (not compressed intraday)          _daily = GetHistoryUnsynched(bars.Symbol, HistoryScale.Daily);          _daily = BarHistorySynchronizer.Synchronize(_daily, bars);                    //plot the daily OHLC prices          PlotTimeSeriesLine(_daily.Open, "Open (D)", "Price", WLColor.Yellow, 1);          PlotTimeSeriesLine(_daily.High, "High (D)", "Price", WLColor.Green, 1);          PlotTimeSeriesLine(_daily.Low, "Low (D)", "Price", WLColor.Red, 1);          PlotTimeSeriesLine(_daily.Close, "Close (D)", "Price", WLColor.Blue, 1);          //overnight high/low as dots          _preHi = PremarketHL.Series(bars, "High");          _preLo = PremarketHL.Series(bars, "Low");          PlotIndicator(_preHi, WLColor.NeonGreen, PlotStyle.Dots);          PlotIndicator(_preLo, WLColor.NeonRed, PlotStyle.Dots);       }       public override void Execute(BarHistory bars, int idx)       {                 }    } }
0

Reply

Bookmark

Sort