📅  最后修改于: 2022-03-11 14:59:58.390000             🧑  作者: Mango
//--- input parameters
// Identify the buffer numbers
const string IndicatorName = "v2ds";
const int IndexRZHigh = 4;
const int IndexRZLow = 5;
const int IndexSZHigh = 6;
const int IndexSZLow = 7;
int Handle;
double BufferRZHigh[3];
double BufferRZLow[3];
double BufferSZHigh[3];
double BufferSZLow[3];
//--- int OnInit()
Handle = iCustom(Symbol(), Period(), IndicatorName);
if(Handle==INVALID_HANDLE)
{
PrintFormat("Error %i", GetLastError());
return(INIT_FAILED);
}
//--- void OnDeinit(const int reason)
IndicatorRelease(Handle);
//--- void OnTick()
//--- Calculate Array From Indicator
int cnt = CopyBuffer(Handle, IndexRZHigh, 0, 3, BufferRZHigh);
if(cnt<3)
return;
cnt = CopyBuffer(Handle, IndexRZLow, 0, 3, BufferRZLow);
cnt = CopyBuffer(Handle, IndexSZHigh, 0, 3, BufferSZHigh);
cnt = CopyBuffer(Handle, IndexSZLow, 0, 3, BufferSZLow);
double currentRZHigh = BufferRZHigh[1];
double currentRZLow = BufferRZLow[1];
double currentSZHigh = BufferSZHigh[1];
double currentSZLow = BufferSZLow[1];
//--- Calculate Prev Close Price
double Close[];
ArraySetAsSeries(Close,true);
CopyClose(_Symbol,0,0,1,Close);
//--- Buy Condition
Close[0]>=currentSZLow && Close[0]currentRZLow