void FindLevels()
{
int Delta = 0;
int DeltaLevel = 0;
int total = ObjectsTotal() - 1;
string name = "";
double high_price = 0, low_price = 0;
for (int i = ObjectsTotal() - 1; i >= 0; i--) {
name = ObjectName(i);
if (StringFind(name, "high_") != -1) {
high_price = ObjectGet(name, OBJPROP_PRICE1);
high_price += Delta*Point;
if((High[0] - DeltaLevel * Point)>high_price && Open[0]<high_price && Bid <= high_price) {
PutOrder(1,Bid);
}
}
if (StringFind(name, "low_") != -1) {
low_price = ObjectGet(name, OBJPROP_PRICE1);
low_price -= Delta*Point;
if((Low[0] + DeltaLevel * Point)<low_price && Open[0]>low_price && Ask >= low_price) {
PutOrder(0,Ask);
}
}
}
}
if(_buyStop && High[2]>=High[1] && High[2]>=High[3])
{
_price = NormalizeDouble(High[2] + StepForStop*Point, Digits);
if(HavePendingOrder(OP_BUYSTOP))
{
if(OrderOpenPrice()>_price) _buyStop=DeletePendingPositions(OP_BUYSTOP);
else _buyStop=false;
}
if(_buyStop) putOrderBuy_stepPoint(_price, Lot, StopLoss, TakeProfit, nameEA);
}
if(_sellStop && Low[2]<=Low[1] && Low[2]<=Low[3])
{
_price = NormalizeDouble(Low[2] - StepForStop*Point, Digits);
if(HavePendingOrder(OP_SELLSTOP))
{
if(OrderOpenPrice()<_price) _sellStop=DeletePendingPositions(OP_SELLSTOP);
else _sellStop = false;
}
if(_sellStop) putOrderSell_stepPoint(_price, Lot, StopLoss, TakeProfit, nameEA);
}
SENNSK