#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion
// This namespace holds all indicators and is required. Do not change it.namespace NinjaTrader.Indicator
{
/// <summary>/// Enter the description of your new custom indicator here/// </summary>
[Description( "Enter the description of your new custom indicator here" )]
publicclass NPSqueeze : Indicator
{
#region Variables
// Wizard generated variablesprivateint length = 20 ; // Default setting for Lengthprivatedouble bBDev = 2 ; // Default setting for BBDevprivatedouble kCDev = 1.5 ; // Default setting for KCDev// User defined variables (add any user defined variables below)#endregion
/// <summary>/// This method is used to configure the indicator and is called once before any bar data is loaded./// </summary>protectedoverridevoid Initialize()
{
Add( new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Bar, "Squeeze" ));
Overlay = false ;
}
/// <summary>/// Called on each bar update event (incoming tick)/// </summary>protectedoverridevoid OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each// plot below by replacing 'Close[0]' with your own formula.double value = Bollinger(bBDev,length).Upper[ 0 ]-KeltnerChannel(kCDev,length).Upper[ 0 ] ;
Squeeze.Set(value);
}
#region Properties
[Browsable( false )] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not removepublic DataSeries Squeeze
{
get { return Values[ 0 ]; }
}
[Description( "BB and KC average length" )]
[GridCategory( "Parameters" )]
publicint Length
{
get { return length; }
set { length = Math.Max( 1 , value); }
}
[Description( "BB deviations" )]
[GridCategory( "Parameters" )]
publicdouble BBDev
{
get { return bBDev; }
set { bBDev = Math.Max( 0 , value); }
}
[Description( "KC deviation in ATR's" )]
[GridCategory( "Parameters" )]
publicdouble KCDev
{
get { return kCDev; }
set { kCDev = Math.Max( 0 , value); }
}
#endregion
}
}
#region NinjaScript generated code. Neither change nor remove.
// This namespace holds all indicators and is required. Do not change it.namespace NinjaTrader.Indicator
{
public partial class Indicator : IndicatorBase
{
private NPSqueeze[] cacheNPSqueeze = null;
privatestatic NPSqueeze checkNPSqueeze = new NPSqueeze();
/// <summary>/// Enter the description of your new custom indicator here/// </summary>/// <returns></returns>public NPSqueeze NPSqueeze( double bBDev, double kCDev, int length)
{
return NPSqueeze(Input, bBDev, kCDev, length);
}
/// <summary>/// Enter the description of your new custom indicator here/// </summary>/// <returns></returns>public NPSqueeze NPSqueeze(Data.IDataSeries input , double bBDev, double kCDev, int length)
{
if (cacheNPSqueeze != null)
for ( int idx = 0 ; idx < cacheNPSqueeze.Length; idx++)
if (Math.Abs(cacheNPSqueeze[idx].BBDev - bBDev) <= double .Epsilon && Math.Abs(cacheNPSqueeze[idx].KCDev - kCDev) <= double .Epsilon && cacheNPSqueeze[idx].Length == length && cacheNPSqueeze[idx].EqualsInput( input ))
return cacheNPSqueeze[idx];
lock (checkNPSqueeze)
{
checkNPSqueeze.BBDev = bBDev;
bBDev = checkNPSqueeze.BBDev;
checkNPSqueeze.KCDev = kCDev;
kCDev = checkNPSqueeze.KCDev;
checkNPSqueeze.Length = length;
length = checkNPSqueeze.Length;
if (cacheNPSqueeze != null)
for ( int idx = 0 ; idx < cacheNPSqueeze.Length; idx++)
if (Math.Abs(cacheNPSqueeze[idx].BBDev - bBDev) <= double .Epsilon && Math.Abs(cacheNPSqueeze[idx].KCDev - kCDev) <= double .Epsilon && cacheNPSqueeze[idx].Length == length && cacheNPSqueeze[idx].EqualsInput( input ))
return cacheNPSqueeze[idx];
NPSqueeze indicator = new NPSqueeze();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
indicator.Input = input ;
indicator.BBDev = bBDev;
indicator.KCDev = kCDev;
indicator.Length = length;
Indicators.Add(indicator);
indicator.SetUp();
NPSqueeze[] tmp = new NPSqueeze[cacheNPSqueeze == null ? 1 : cacheNPSqueeze.Length + 1 ];
if (cacheNPSqueeze != null)
cacheNPSqueeze.CopyTo(tmp, 0 );
tmp[tmp.Length - 1 ] = indicator;
cacheNPSqueeze = tmp;
return indicator;
}
}
}
}
// This namespace holds all market analyzer column definitions and is required. Do not change it.namespace NinjaTrader.MarketAnalyzer
{
public partial class Column : ColumnBase
{
/// <summary>/// Enter the description of your new custom indicator here/// </summary>/// <returns></returns>
[Gui.Design.WizardCondition( "Indicator" )]
public Indicator.NPSqueeze NPSqueeze( double bBDev, double kCDev, int length)
{
return _indicator.NPSqueeze(Input, bBDev, kCDev, length);
}
/// <summary>/// Enter the description of your new custom indicator here/// </summary>/// <returns></returns>public Indicator.NPSqueeze NPSqueeze(Data.IDataSeries input , double bBDev, double kCDev, int length)
{
return _indicator.NPSqueeze( input , bBDev, kCDev, length);
}
}
}
// This namespace holds all strategies and is required. Do not change it.namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>/// Enter the description of your new custom indicator here/// </summary>/// <returns></returns>
[Gui.Design.WizardCondition( "Indicator" )]
public Indicator.NPSqueeze NPSqueeze( double bBDev, double kCDev, int length)
{
return _indicator.NPSqueeze(Input, bBDev, kCDev, length);
}
/// <summary>/// Enter the description of your new custom indicator here/// </summary>/// <returns></returns>public Indicator.NPSqueeze NPSqueeze(Data.IDataSeries input , double bBDev, double kCDev, int length)
{
if (InInitialize && input == null)
throw new ArgumentException( "You only can access an indicator with the default input/bar series from within the 'Initialize()' method" );
return _indicator.NPSqueeze( input , bBDev, kCDev, length);
}
}
}
나는 다음 날의 외환 쌍 가격 예측을 위한 MATLAB 코드를 개발했습니다. 이제 .csv 파일을 읽을 수 있는 mql4의 전문가가 필요합니다. 날짜, 시간, 기호 및 신호(구매=1, 판매=-1 및 0=아무것도 없음)가 포함되어 있으며 일정한 SL, TP 및 LOTS가 있습니다.
안녕하세요 여러분! 질문이 하나 있는데 도움이 필요합니다. 나는 진입/퇴장/TP/SL 등에 대한 여러 지표를 기반으로 EA를 만들었습니다. 제 문제는 너무 많은 거래를 시작한다는 것입니다. 내 말은 : 거래를 시작하는 조건 중 하나로 하나의 2 라인 교차 표시가 있습니다. 위로 교차하는 경우 + 다른 조건이 매수 거래를 시작하고, 아래로 교차하는 경우 + 다른 조건이 열린 경우 판매가 시작됩니다. 따라서 지표가 교차하고 다른 모든 조건이 충족되고 거래가 시작된다고 가정해 보겠습니다. 몇 초 후에 TP에 도달하고 거래가 마감됩니다. 그러나 지표는 아직 반대 방향으로 뒤집히지 않고 또 다른 거래가 열립니다. 이것은 특정 조건에서 멈추고 싶은 것입니다. 예를 들어 표시기가 7개의 양초를 뒤집었다면 거래를 열지 마십시오. 내 말은 예를 들어 추세가 형성되고 있고, 모든 지표가 거래 개시에 동의하고, 거래가 개시되고, 4-5 캔들 후에 TP에 도달한다는 것입니다. 그리고 또 다른 오더가 열렸는데 아마 추세가 거의 끝나서 바닥에 가깝게 진입하고 있습니다. 이것은 내가 변경하고 싶습니다. 내 지표가 [7] 전에 양초를 뒤집었다면 거래를 열지 않는 그런 방식으로 조건을 만드는 것.
안녕하세요 사람들. 캔들 패턴이 닫힌 것으로 감지된 후 코드 그리기 상자를 만들고 텍스트를 한 번만 인쇄하는 데 필요한 것이 무엇인지 알 수 있습니까?
자신의 값으로 mq4 수평선 을 만드는 방법. 제발
Ninja 표시기를 MQL4, MT4로 변환하는 데 도움이 필요합니다.
판독기
좋아요
좋은 하루 코더,
나는 다음 날의 외환 쌍 가격 예측을 위한 MATLAB 코드를 개발했습니다. 이제 .csv 파일을 읽을 수 있는 mql4의 전문가가 필요합니다. 날짜, 시간, 기호 및 신호(구매=1, 판매=-1 및 0=아무것도 없음)가 포함되어 있으며 일정한 SL, TP 및 LOTS가 있습니다.
당신이 저를 위해 그것을 제공한다면 나는 감사할 것입니다.
고마워 마리암.
이중 게시 하지 마십시오! 이미 다른 스레드가 열려 있습니다.
포럼의 일반 규칙 및 모범 사례. - 일반 - MQL5 프로그래밍 포럼 (20 17 )