#property version "1.00"
#include <Trade\Trade.mqh>
#include <Trade\PositionInfo.mqh>
#include <Trade\AccountInfo.mqh>
input int n=5; // MA Period
input int take=50; // ??????? ?????? ???????
input int drop=1000; // ??????? ?????? ??????
input double k=0.5; // ??????? ????????
input double r=0.01; // ??????? ?????
input double max_lots=1; // ???????????? ??? (0-??? ???????????)
int imaHandle,sp=30;
bool order_opened,f_buy,f_sell,f_buy_modify,f_sell_modify,f_close;
double lot,k1,aIMA[];
datetime h,aT[1];
MqlTick current_price;
CPositionInfo current_order;
CAccountInfo account_info;
CTrade trade;
int OnInit()
{
// код доступен только после оплаты
}
void OnDeinit(const int reason)
{
IndicatorRelease(imaHandle);
}
void OnTick()
{
// код доступен только после оплаты
}
order_opened=current_order.Select(_Symbol);
CopyTime(_Symbol,0,0,1,aT); //????????? ????? ???????? ?????????? ????
if(!order_opened && h!=aT[0])
{
CopyBuffer(imaHandle,0,0,2,aIMA); //???????? ? ????? ?????? ??????????
ArraySetAsSeries(aIMA,true); //????????????? ?????????? ??????? ??? ?????????
k1=(aIMA[0]-aIMA[1])/MathAbs(aIMA[1]);
f_buy=(k1>=k); //?????? ? ???????? ??????? ???????
f_sell=(k1<=-k); //?????? ? ???????? ???????? ???????
h=aT[0];
}
if(order_opened && current_order.Profit()>0)
{
SymbolInfoTick(_Symbol,current_price);
f_buy_modify=(current_order.Type()==POSITION_TYPE_BUY &&
(current_price.bid-current_order.PriceOpen())/_Point>take &&
(current_price.bid-current_order.StopLoss())/_Point>take);
f_sell_modify=(current_order.Type()==POSITION_TYPE_SELL &&
(current_order.PriceOpen()-current_price.ask)/_Point>take &&
(MПоказано первые 50% кода (символов: 3317)
Введите ваш email и нажмите кнопку, чтобы перейти к оплате.