Нужна консультация по настройке советника! - страница 2

 
А че ладом ни как не получается код вставить?
 
sanyooooook:
А че ладом ни как не получается код вставить?
на форуме я чайник
 
Evgenik20:
на форуме я чайник

тогда тебе ни че не поможет
 

Давайте попробуем еще раз. Я вставлю "ладом" Ваш код (кнопка SRC на верхней панели), а Александр посмотрит, если будет возможность.


extern int timeframe = 60;
extern double stopLoss = 50;
extern double lTakeProfit = 20;
extern double sTakeProfit = 20;
extern double lTrailingStop = 15;
extern double sTrailingStop = 15;
extern color clOpenBuy = Blue;
extern color clCloseBuy = Aqua;
extern color clOpenSell = Red;
extern color clCloseSell = Violet;
extern color clModiBuy = Blue;
extern color clModiSell = Red;
extern string Name_Expert = "my 100pip v1";
extern int Slippage = 2;
extern bool UseSound = True;
extern string NameFileSound = "shotgun.wav";
extern double Lots = 1;


void deinit() {
Comment("");
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start(){
if(Bars<100){
Print("bars less than 100");
return(0);
}
if(lTakeProfit<10){
Print("TakeProfit less than 10");
return(0);
}
if(sTakeProfit<10){
Print("TakeProfit less than 10");
return(0);
}

double diClose0=iClose(NULL,5,0);
double diMA1=iMA(NULL,5,7,0,MODE_SMA,PRICE_OPEN,0);
double diClose2=iClose(NULL,5,0);
double diMA3=iMA(NULL,5,6,0,MODE_SMA,PRICE_OPEN,0);

if(AccountFreeMargin()<(1000*Lots)){
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
if (!ExistPositions()){

if ((diClose0<diMA1)){
OpenBuy();
return(0);
}

if ((diClose2>diMA3)){
OpenSell();
return(0);
}
}
TrailingPositionsBuy(lTrailingStop);
TrailingPositionsSell(sTrailingStop);
return (0);
}

bool ExistPositions() {
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol()) {
return(True);
}
}
}
return(false);
}
void TrailingPositionsBuy(int trailingStop) {
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol()) {
if (OrderType()==OP_BUY) {
if (Bid-OrderOpenPrice()>trailingStop*Point) {
if (OrderStopLoss()<Bid-trailingStop*Point)
ModifyStopLoss(Bid-trailingStop*Point);
}
}
}
}
}
}
void TrailingPositionsSell(int trailingStop) {
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol()) {
if (OrderType()==OP_SELL) {
if (OrderOpenPrice()-Ask>trailingStop*Point) {
if (OrderStopLoss()>Ask+trailingStop*Point ||
OrderStopLoss()==50)
ModifyStopLoss(Ask+trailingStop*Point);
}
}
}
}
}
}
void ModifyStopLoss(double ldStopLoss) {
bool fm;
fm = OrderModify(OrderTicket(),OrderOpenPrice
(),ldStopLoss,OrderTakeProfit(),0,CLR_NONE);
if (fm && UseSound) PlaySound(NameFileSound);
}

void OpenBuy() {
double ldLot, ldStop, ldTake;
string lsComm;
ldLot = GetSizeLot();
ldStop = 0;
ldTake = GetTakeProfitBuy();
lsComm = GetCommentForOrder();
OrderSend(Symbol
(),OP_BUY,ldLot,Ask,Slippage,ldStop,ldTake,lsComm,0,0,clOpenBuy);
if (UseSound) PlaySound(NameFileSound);
}
void OpenSell() {
double ldLot, ldStop, ldTake;
string lsComm;

ldLot = GetSizeLot();
ldStop = 0;
ldTake = GetTakeProfitSell();
lsComm = GetCommentForOrder();
OrderSend(Symbol
(),OP_SELL,ldLot,Bid,Slippage,ldStop,ldTake,lsComm,0,0,clOpenSell);
if (UseSound) PlaySound(NameFileSound);
}
string GetCommentForOrder() { return(Name_Expert); }
double GetSizeLot() { return(Lots); }
double GetTakeProfitBuy() { return(Ask+lTakeProfit*Point); }

double GetTakeProfitSell() { return(Bid-sTakeProfit*Point); }


 
granit77:

Давайте попробуем еще раз. Я вставлю "ладом" Ваш код, а Александр посмотрит, если будет возможность.


А можешь ещё отредактировать, что бы понятно было какой кусок какому if-у? ))
 
granit77:

Давайте попробуем еще раз. Я вставлю "ладом" Ваш код (кнопка SRC на верхней панели), а Александр посмотрит, если будет возможность.



технично отмазался ))
 
extern int timeframe = 60;
extern double stopLoss = 50;
extern double lTakeProfit = 20;
extern double sTakeProfit = 20;
extern double lTrailingStop = 15;
extern double sTrailingStop = 15;
extern color clOpenBuy = Blue;
extern color clCloseBuy = Aqua;
extern color clOpenSell = Red;
extern color clCloseSell = Violet;
extern color clModiBuy = Blue;
extern color clModiSell = Red;
extern string Name_Expert = "my 100pip v1";
extern int Slippage = 2;
extern bool UseSound = True;
extern string NameFileSound = "shotgun.wav";
extern double Lots = 1;


void deinit() {
Comment("");
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start(){
if(Bars<100){
Print("bars less than 100");
return(0);
}
if(lTakeProfit<10){
Print("TakeProfit less than 10");
return(0);
}
if(sTakeProfit<10){
Print("TakeProfit less than 10");
return(0);
}

double diClose0=iClose(NULL,5,0);
double diMA1=iMA(NULL,5,7,0,MODE_SMA,PRICE_OPEN,0);
//double diClose2=iClose(NULL,5,0);
double diMA3=iMA(NULL,5,6,0,MODE_SMA,PRICE_OPEN,0);

if(AccountFreeMargin()<(1000*Lots)){
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
if (!ExistPositions()){

if (diClose0>diMA1)//((diClose0<diMA1))
{
OpenBuy();
return(0);
}

if (diClose0<diMA3)//((diClose2>diMA3))
{
OpenSell();
return(0);
}
}
TrailingPositionsBuy(lTrailingStop);
TrailingPositionsSell(sTrailingStop);
return (0);
}

bool ExistPositions() {
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol()) {
return(True);
}
}
}
return(false);
}
void TrailingPositionsBuy(int trailingStop) {
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol()) {
if (OrderType()==OP_BUY) {
if (Bid-OrderOpenPrice()>trailingStop*Point) {
if (OrderStopLoss()<Bid-trailingStop*Point)
ModifyStopLoss(Bid-trailingStop*Point);
}
}
}
}
}
}
void TrailingPositionsSell(int trailingStop) {
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol()) {
if (OrderType()==OP_SELL) {
if (OrderOpenPrice()-Ask>trailingStop*Point) {
if (OrderStopLoss()>Ask+trailingStop*Point ||
OrderStopLoss()==50)
ModifyStopLoss(Ask+trailingStop*Point);
}
}
}
}
}
}
void ModifyStopLoss(double ldStopLoss) {
bool fm;
fm = OrderModify(OrderTicket(),OrderOpenPrice
(),ldStopLoss,OrderTakeProfit(),0,CLR_NONE);
if (fm && UseSound) PlaySound(NameFileSound);
}

void OpenBuy() {
double ldLot, ldStop, ldTake;
string lsComm;
ldLot = GetSizeLot();
ldStop = 0;
ldTake = GetTakeProfitBuy();
lsComm = GetCommentForOrder();
OrderSend(Symbol
(),OP_BUY,ldLot,Ask,Slippage,ldStop,ldTake,lsComm,0,0,clOpenBuy);
if (UseSound) PlaySound(NameFileSound);
}
void OpenSell() {
double ldLot, ldStop, ldTake;
string lsComm;

ldLot = GetSizeLot();
ldStop = 0;
ldTake = GetTakeProfitSell();
lsComm = GetCommentForOrder();
OrderSend(Symbol
(),OP_SELL,ldLot,Bid,Slippage,ldStop,ldTake,lsComm,0,0,clOpenSell);
if (UseSound) PlaySound(NameFileSound);
}
string GetCommentForOrder() { return(Name_Expert); }
double GetSizeLot() { return(Lots); }
double GetTakeProfitBuy() { return(Ask+lTakeProfit*Point); }

double GetTakeProfitSell() { return(Bid-sTakeProfit*Point); }
пробуй так
Причина обращения: