public static bool AlmostEquals(this double double1, double double2, double precision)public static bool AlmostEquals(double double1, double double2, double precision)
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators;namespace WealthLab.Strategies { public class AlmostEqualsDemo : WealthScript { protected override void Execute() { double tick = Bars.SymbolInfo.Tick; SetBarColors( Color.Silver, Color.Silver ); for(int bar = 1; bar < Bars.Count; bar++) { bool result = ( Closebar.AlmostEquals(Lowbar,tick) || Closebar.AlmostEquals(Lowbar+tick,tick) || Openbar.AlmostEquals(Lowbar,tick) || Openbar.AlmostEquals(Lowbar+tick,tick) ); if( result ) SetBarColor( bar, Color.Magenta ); } } } }
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using Community.Components;namespace WealthLab.Strategies { using c = Community.Components.Calculate; public class AlmostEqualsDemo : WealthScript { protected override void Execute() { double tick = Bars.SymbolInfo.Tick; SetBarColors( Color.Silver, Color.Silver ); for(int bar = 1; bar < Bars.Count; bar++) { bool result = ( c.AlmostEquals(Closebar,Lowbar,tick) || c.AlmostEquals(Closebar,Lowbar+tick,tick) || c.AlmostEquals(Openbar,Lowbar,tick) || c.AlmostEquals(Openbar,Lowbar+tick,tick) ); if( result ) SetBarColor( bar, Color.Magenta ); } } } }