Nasıl kodlanır? - sayfa 144

 

bu yanlış : if(totalOrders==0 && Magic==OrderMagicNumber() &&

OrderSelect(i-1 , SELECT_BY_POS,MODE_HISTORY)==true)

çünkü OrderMagicNumber()'ı OrderSelect()'ten önce çağırıyorsunuz, bu yüzden muhtemelen önceki çağrıya atıfta bulunuyor.

 
EBK:
Ah, üzgünüm, fikrimi yanlış ifade ettim.

Öz sermaye bir değerin altındaysa EA ticaretini (veya ea ticaretinin bir kısmını) durduracak bir şey kodlamak istiyorum (ama yapamıyorum).

Yardımın için teşekkürler Roger09, ama hisse senedini grafikte göstermeme gerek yok.

Bu EA'yı deneyin

CloseAllBuySell - MQL4 Kod Tabanı

Fikrini kullanın ve bir şeyle bir kod yapın

if (AccountEquity()<YourValue) closeallorders();

 

Birisi lütfen EMA son durağını Hareketli Ortalama EA örneğine ekleyebilir mi?

EMA sonu 1 olarak ayarlandı

Ardından girişi şu şekilde değiştirin:

Buy=Aç[1]>ma && Kapat[1]>ma;

Sat=Aç[1]<ma && Kapat[1]<ma;

Bu, çok iyi bir basit saç kazıyıcı yapmalıdır.

Şerefe

Beno

Dosyalar:
 
 

Programın başına ekle

extern int pip=2;//(veya pip sayınız)

sonra değiştir

if ((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice()))

sl = OrderOpenPrice() ;

if ((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice()))

sl = OrderOpenPrice() ;[/CODE]

to

[CODE]if ((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice()))

sl = OrderOpenPrice() +pips*Point;

if ((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice()))

sl = OrderOpenPrice() -pips*Point;
 

Birisi bu göstergeye yeni bir ok çizdiğinde bir uyarı koymama yardım edebilir mi?

Teşekkürler!

Dosyalar:
hilow3.mq4  2 kb
 

Hayır, düzelt

harici int pip=2;

//+------------------------------------------- -------------------+

//| komut dosyası programı başlatma işlevi |

//+------------------------------------------- -------------------+

int başlangıç()

{

//----

string curr = Sembol();

int ot = OrdersTotal();

int ords[200], ordType[200], ordTicket[200]; çift ordLots[200];

string ordComments[200];

int ix=0;

için (int i=0; i<ot; i++)

{

int o = OrderSelect(i, SELECT_BY_POS);

if (OrderSymbol() == Symbol())

if ((OrderType() == OP_BUY) || (OrderType() == OP_SEL))

{

çift sl = 0;

if ((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice()))

sl = OrderOpenPrice() +pip*Nokta;

if ((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice()))

sl = OrderOpenPrice() -pip*Nokta;

eğer (sl != 0+10)

OrderModify(OrderTicket(), OrderOpenPrice(), sl, OrderTakeProfit(), 0);

}

}

//----

dönüş(0);

 

Tamam, kod şimdi şöyle görünüyor:

harici int pip=10;//

//+------------------------------------------- -------------------+

//| komut dosyası programı başlatma işlevi |

//+------------------------------------------- -------------------+

int başlangıç()

{

//----

string curr = Sembol();

int ot = OrdersTotal();

int ords[200], ordType[200], ordTicket[200]; çift ordLots[200];

string ordComments[200];

int ix=0;

için (int i=0; i<ot; i++)

{

int o = OrderSelect(i, SELECT_BY_POS);

if (OrderSymbol() == Symbol())

if ((OrderType() == OP_BUY) || (OrderType() == OP_SEL))

{

çift sl = 0;

if ((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice()))

sl = OrderOpenPrice() +pip*Nokta;

if ((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice()))

sl = OrderOpenPrice() -pip*Nokta;

eğer (sl != 0)

OrderModify(OrderTicket(), OrderOpenPrice(), sl, OrderTakeProfit(), 0);

}

}

//----

dönüş(0);

}

//+------------------------------------------- -------------------+

 

Merhaba Roger09,

Bu kodla ilgili yardımlarınız için çok teşekkürler. Komut dosyası kodum şimdi şöyle görünüyor (sadece bu yanıt için kırmızıdaki değişiklikleri ekledim, MQ4'teki kod, oradaki diğerlerine benziyor):

//+------------------------------------------- -------------------+

//| komut dosyası programı başlatma işlevi |

//+------------------------------------------- -------------------+

int başlangıç()

{

//----

harici int pip=2;//

string curr = Sembol();

int ot = OrdersTotal();

int ords[200], ordType[200], ordTicket[200]; çift ordLots[200];

string ordComments[200];

int ix=0;

için (int i=0; i<ot; i++)

{

int o = OrderSelect(i, SELECT_BY_POS);

if (OrderSymbol() == Symbol())

if ((OrderType() == OP_BUY) || (OrderType() == OP_SEL))

{

çift sl = 0;

if ((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice()))

sl = OrderOpenPrice() +pip*Nokta;

if ((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice()))

sl = OrderOpenPrice() -pip*Nokta;

eğer (sl != 0)

OrderModify(OrderTicket(), OrderOpenPrice(), sl, OrderTakeProfit(), 0);

}

}

//----

dönüş(0);

Doğru anladıysam haber verir misin? Burada kör uçuyorum, o yüzden sabret.

 

Aslında çalışacak, ancak bu kod iyi değil. Ne yazık ki ana hedeflerinizi bilmiyorum ve başka bir şey öneremem.

Neden: