شكرا استاذ اسلام
انا حاولت كتابة الكود لكن فى كل مرة تكون الخسارة مختلفة
ممكن القاء نظرة على هذا الكود لاكسبيرت تقاطع السعر للموفينج انا كتبت متغير المخاطرة risk بالاعلى وسطر القسمة هو
double speed5=risk/SL;
Comment(speed5);
double Lot=speed5/10;
//+------------------------------------------------------------------+
//| ppp.mq4 |
//| Copyright 2016, MetaQuotes Software Corp. |
//|
MQL5: automated forex trading, strategy tester and custom indicators with MetaTrader |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
extern double MagicNumber ;
extern double risk;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
double ma1,ma2,ma3;
ma1=iMA(NULL,0,15,0,MODE_SMA,PRICE_CLOSE,1);
ma2=iMA(NULL,0,15,0,MODE_SMA,PRICE_CLOSE,2);
ma3=iMA(NULL,0,30,0,MODE_SMA,PRICE_CLOSE,1);
double Speed=MathAbs(ma3-Close[1])/Point;
Comment(Speed);
double Speed2=Speed+400;
double SL,TP;
if ( ma1>ma3&&Close[2]<ma2&&Close[1]>ma1 ){
SL=Ask-Speed2*Point;
TP=Ask+Speed2*Point;
/////////////
double speed5=risk/SL;
Comment(speed5);
double Lot=speed5/10;
//////////////
OrderSend(Symbol(),OP_BUY,Lot,Ask,3,SL,TP,"klk",Ma gicNumber,0,Blue);
PlaySound("Alert.wav");}}
//+------------------------------------------------------------------+