Open Forex4you Account

Server Ãѹ EA 1000 / »Õ

ÊÑ觪×éͤÙèÁ×Í¡ÒÃâ»ÃááÁ MQL4

Author Topic: ÍÕ¡¤ÃÑ駤ÃѺ ªèÇ´٠Source code ¤ÃѺ  (Read 12952 times)

risman

  • Newbie
  • *
  • Posts: 21
ÍÕ¡¤ÃÑ駤ÃѺ ªèÇ´٠Source code ¤ÃѺ
« on: ÁԶعÒ¹ 14, 2012, 05:23:10 pm »
¢ÍÇÔ¸Õá¡é䢡ÒõÑ駤èÒ Take/Profit ¢Í§ ea ¹Õé
Ṻ Source ÁÒãËé Ê´æÃé͹æ àŤÃѺ 
¢Íº¤Ø³Åèǧ˹éÒ¤ÃѺ

Help Me, Please & Thank you...

admin

  • Administrator
  • Hero Member
  • *****
  • Posts: 2386
Re: ÍÕ¡¤ÃÑ駤ÃѺ ªèÇ´٠Source code ¤ÃѺ
« Reply #1 on: ÁԶعÒ¹ 18, 2012, 04:53:13 pm »
code ·Õè¤Ø³¹ÓÁÒâ¾ÊÁѹÁÕ¡ÒÃà¢Õ¹ºÍ¡ËÁ´áÅéǹÕé¤ÃѺÇèÒ ¤èÒ¾ÒÃÒÁÔàµÍÃìµÑÇä˹ãªé·ÓÍÐäÃÁÑé§ ¹Õé¤ÃѺ

//+-----------------------------------------------------------------+
//| External Parameters Set                                         |
//+-----------------------------------------------------------------+

extern string   Version.3.9.6.05    = "EA Settings:";
extern string   TradeComment        = "Blessing 3.9.6";
extern int      EANumber            = 1;        // Enter a unique number to identify this EA
extern bool     EmergencyCloseAll   = false;    // Setting this to true will close all open orders immediately

extern string   LabelAcc            = "Account Trading Settings:";
extern bool     ShutDown            = false;    // Setting this to true will stop the EA trading after any open trades have been closed
extern double   StopTradePercent    = 10;       // percent of account balance lost before trading stops
extern bool     NanoAccount         = false;    // set to true for nano "penny a pip" account (contract size is $10,000)
extern double   PortionPC           = 100;      // Percentage of account you want to trade on this pair
extern double   MaxDDPercent        = 50;       // Percent of portion for max drawdown level.
extern double   MaxSpread           = 5;        // Maximum allowed spread while placing trades
extern bool     UseHolidayShutdown  = true;     // Will shutdown over holiday period
extern string   Holidays            = "18/12-01/01"; // List of holidays, each seperated by a comma, [day]/[mth]-[day]/[mth], dates inclusive
extern bool     PlaySounds          = false;    // will sound alarms
extern string   AlertSound          = "Alert.wav";  // Alarm sound to be played

extern string   LabelIES            = "Indicator / Entry Settings:";
extern bool     B3Traditional       = true;     // Stop/Limits for entry if true, Buys/Sells if false
extern int      ForceMarketCond     = 3;        // Market condition 0=uptrend 1=downtrend 2=range 3=off
extern bool     UseAnyEntry         = false;    // true = ANY entry can be used to open orders, false = ALL entries used to open orders
extern int      MAEntry             = 1;        // 0 = Off, 1 = will base entry on MA channel, 2 = will trade in reverse
extern int      CCIEntry            = 0;        // 0 = Off, 1 = will base entry on CCI indicator, 2 = will trade in reverse
extern int      BollingerEntry      = 0;        // 0 = Off, 1 = will base entry on BB, 2 = will trade in reverse
extern int      StochEntry          = 0;        // 0 = Off, 1 = will base entry on Stoch, 2 = will trade in reverse
extern int      MACDEntry           = 0;        // 0 = Off, 1 = will base entry on MACD, 2 = will trade in reverse

extern string   LabelLS             = "Lot Size Settings:";
extern bool     UseMM               = true;    // Money Management
extern double   LAF                 = 0.5;      // Adjusts MM base lot for large accounts
extern double   Lot                 = 0.01;     // Starting lots if Money Management is off
extern double   Multiplier          = 1.4;      // Multiplier on each level

extern string   LabelGS             = "Grid Settings:";
extern bool     AutoCal             = false;    // Auto calculation of TakeProfit and Grid size;
extern string   LabelATRTFr         = "0:Chart, 1:M1, 2:M5, 3:M15, 4:M30, 5:H1, 6:H4, 7:D1, 8:W1, 9:MN1";
extern int      ATRTF               = 0;        // TimeFrame for ATR calculation
extern int      ATRPeriods          = 21;       // Number of periods for the ATR calculation
extern double   GAF                 = 1.0;      // Widens/Squishes Grid on increments/decrements of .1
extern int      EntryDelay          = 2400;     // Time Grid in seconds, to avoid opening of lots of levels in fast market
extern double   EntryOffset         = 5;        // In pips, used in conjunction with logic to offset first trade entry
extern bool     UseSmartGrid        = true;     // True = use RSI/MA calculation for next grid order

extern string   LabelTS             = "Trading Settings:";
extern int      MaxTrades           = 15;       // Maximum number of trades to place (stops placing orders when reaches MaxTrades)
extern int      BreakEvenTrade      = 12;       // Close All level, when reaches this level, doesn't wait for TP to be hit
extern double   BEPlusPips          = 2;        // Pips added to Break Even Point before BE closure
extern bool     UseCloseOldest      = false;    // True = will close the oldest open trade after CloseTradesLevel is reached
extern int      CloseTradesLevel    = 5;        // will start closing oldest open trade at this level
extern bool     ForceCloseOldest    = true;     // Will close the oldest trade whether it has potential profit or not
extern int      MaxCloseTrades      = 4;        // Maximum number of oldest trades to close
extern double   CloseTPPips         = 10;       // After Oldest Trades have closed, Forces Take Profit to BE +/- xx Pips
extern double   ForceTPPips         = 0;        // Force Take Profit to BE +/- xx Pips
extern double   MinTPPips           = 0;        // Ensure Take Profit is at least BE +/- xx Pips

extern string   LabelHS             = "Hedge Settings:";
extern string   HedgeSymbol         = "";       // Enter the Symbol of the same/correlated pair EXACTLY as used by your broker.
extern int      CorrPeriod          = 30;       // Number of days for checking Hedge Correlation
extern bool     UseHedge            = false;    // Turns DD hedge on/off
extern string   DDorLevel           = "DD";     // DD = start hedge at set DD; Level = Start at set level
extern double   HedgeStart          = 20;       // DD Percent or Level at which Hedge starts
extern double   hLotMult            = 0.8;      // Hedge Lots = Open Lots * hLotMult
extern double   hMaxLossPips        = 30;       // DD Hedge maximum pip loss - also hedge trailing stop
extern bool     hFixedSL            = false;    // true = fixed SL at hMaxLossPips
extern double   hTakeProfit         = 30;       // Hedge Take Profit
extern double   hReEntryPC          = 5;        // Increase to HedgeStart to stop early re-entry of the hedge
extern bool     StopTrailAtBE       = true;     // True = Trailing Stop will stop at BE; False = Hedge will continue into profit
extern bool     ReduceTrailStop     = true;     // False = Trailing Stop is Fixed; True = Trailing Stop will reduce after BE is reached

extern string   LabelES             = "Exit Settings:";
extern bool     MaximizeProfit      = false;    // Turns on TP move and Profit Trailing Stop Feature
extern double   ProfitSet           = 70;       // Locks in Profit at this percent of Total Profit Potential
extern double   MoveTP              = 30;       // Moves TP this amount in pips
extern int      TotalMoves          = 2;        // Number of times you want TP to move before stopping movement
extern bool     UseStopLoss         = false;    // Use Stop Loss and/or Trailing Stop Loss
extern double   SLPips              = 30;       // Pips for fixed StopLoss from BE, 0=off
extern double   TSLPips             = 10;       // Pips for trailing stop loss from BE + TSLPips: +ve = fixed trail; -ve = reducing trail; 0=off
extern double   TSLPipsMin          = 3;        // Minimum trailing stop pips if using reducing TS
extern bool     UsePowerOutSL       = false;    // Transmits a SL in case of internet loss
extern double   POSLPips            = 600;      // Power Out Stop Loss in pips
extern bool     UseFIFO             = false;    //

extern string   LabelEE             = "Early Exit Settings:";
extern bool     UseEarlyExit        = false;    // Reduces ProfitTarget by a percentage over time and number of levels open
extern double   EEStartHours        = 3;        // Number of Hours to wait before EE over time starts
extern bool     EEFirstTrade        = true;     // true = StartHours from FIRST trade: false = StartHours from LAST trade
extern double   EEHoursPC           = 0.5;      // Percentage reduction per hour (0 = OFF)
extern int      EEStartLevel        = 5;        // Number of Open Trades before EE over levels starts
extern double   EELevelPC           = 10;       // Percentage reduction at each level (0 = OFF)
extern bool     EEAllowLoss         = false;    // true = Will allow the basket to close at a loss : false = Minimum profit is Break Even

extern string   LabelAdv            = "Advanced Settings Change sparingly";

extern string   LabelGrid           = "Grid Size Settings:";
extern string   SetCountArray       = "4,4";    // Specifies number of open trades in each block (separated by a comma)
extern string   GridSetArray        = "25,50,100"; // Specifies number of pips away to issue limit order (separated by a comma)
extern string   TP_SetArray         = "50,100,200"; // Take profit for each block (separated by a comma)

extern string   LabelMA             = "MA Entry Settings:";
extern int      MAPeriod            = 100;      // Period of MA (H4 = 100, H1 = 400)
extern double   MADistance          = 10;       // Distance from MA to be treated as Ranging Market

extern string   LabelCCI            = "CCI Entry Settings:";
extern int      CCIPeriod           = 14;       // Period for CCI calculation

extern string   LabelBBS            = "Bollinger Bands Entry Settings:";
extern int      BollPeriod          = 10;       // Period for Bollinger
extern double   BollDistance        = 10;       // Up/Down spread
extern double   BollDeviation       = 2.0;      // Standard deviation multiplier for channel

extern string   LabelSto            = "Stochastic Entry Settings:";
extern int      BuySellStochZone    = 20;       // Determines Overbought and Oversold Zones
extern int      KPeriod             = 10;       // Stochastic KPeriod
extern int      DPeriod             = 2;        // Stochastic DPeriod
extern int      Slowing             = 2;        // Stochastic Slowing

extern string   LabelMACD           = "MACD Entry Settings:";
extern string   LabelMACDTF         = "0:Chart, 1:M1, 2:M5, 3:M15, 4:M30, 5:H1, 6:H4, 7:D1, 8:W1, 9:MN1";
extern int      MACD_TF             = 0;        // Time frame for MACD calculation
extern int      FastPeriod          = 12;       // MACD EMA Fast Period
extern int      SlowPeriod          = 26;       // MACD EMA Slow Period
extern int      SignalPeriod        = 9;        // MACD EMA Signal Period
extern int      MACDPrice           = 0;        // 0=close, 1=open, 2=high, 3=low, 4=HL/2, 5=HLC/3 6=HLCC/4

extern string   LabelSG             = "Smart Grid Settings:";
extern string   LabelSGTF           = "0:Chart, 1:M1, 2:M5, 3:M15, 4:M30, 5:H1, 6:H4, 7:D1, 8:W1, 9:MN1";
extern int      RSI_TF              = 3;        // Timeframe for RSI calculation - should be less than chart TF.
extern int      RSI_Period          = 14;       // Period for RSI calculation
extern int      RSI_Price           = 0;        // 0=close, 1=open, 2=high, 3=low, 4=HL/2, 5=HLC/3 6=HLCC/4
extern int      RSI_MA_Period       = 10;       // Period for MA of RSI calculation
extern int      RSI_MA_Method       = 0;        // 0=Simple MA, 1=Exponential MA, 2=Smoothed MA, 3=Linear Weighted MA

extern string   LabelOS             = "Other Settings:";
extern bool     RecoupClosedLoss    = true;     // true = Recoup any Hedge/CloseOldest losses: false = Use original profit target.
extern int      Level               = 7;        // Largest Assumed Basket size.  Lower number = higher start lots
extern int      slip                = 99;       // Adjusts opening and closing orders by "slipping" this amount
extern bool     SaveStats           = false;    // true = will save equity statistics
extern int      StatsPeriod         = 3600;     // seconds betwen stats entries - off by default
extern bool     StatsInitialise     = true;     // true for backtest - false for foward/live to ACCUMULATE equity traces

extern string   LabelUE             = "Email Settings:";
extern bool     UseEmail            = false;
extern string   LabelEDD            = "At what DD% would you like Email warnings (Max: 49, Disable: 0)?";
extern double   EmailDD1            = 20;
extern double   EmailDD2            = 30;
extern double   EmailDD3            = 40;
extern string   LabelEH             = "Number of hours before DD timer resets";
extern double   EmailHours          = 24;       // Minimum number of hours between emails

extern string   LabelDisplay        = "Used to Adjust Overlay";
extern bool     displayOverlay      = true;     // Turns the display on and off
extern bool     displayLogo         = true;     // Turns off copyright and icon
extern bool     displayCCI          = true;     // Turns off the CCI display
extern bool     displayLines        = true;     // Show BE, TP and TS lines
extern int      displayXcord        = 100;      // Moves display left and right
extern int      displayYcord        = 22;       // Moves display up and down
extern int      displayCCIxCord     = 10;       // Moves CCI display left and right
extern string   displayFont         = "Arial Bold";//Display font
extern int      displayFontSize     = 9;        // Changes size of display characters
extern int      displaySpacing      = 14;       // Changes space between lines
extern double   displayRatio        = 1;        // Ratio to increase label width spacing
extern color    displayColor        = DeepSkyBlue; // default color of display characters
extern color    displayColorProfit  = Green;    // default color of profit display characters
extern color    displayColorLoss    = Red;      // default color of loss display characters
extern color    displayColorFGnd    = White;    // default color of ForeGround Text display characters

extern bool     Debug               = false;

extern string   LabelOpt            = "These values can only be used while optimizing";
extern bool     UseGridOpt          = false;    // Set to true if you want to be able to optimize the grid settings.
extern int      SetArray1           = 4;        // These values will replace the normal SetCountArray,
extern int      SetArray2           = 4;        // GridSetArray and TP_SetArray during optimization.
extern int      SetArray3           = 0;        // The default values are the same as the normal array defaults
extern int      SetArray4           = 0;
extern int      GridArray1          = 25;       // REMEMBER:
extern int      GridArray2          = 50;       // There must be one more value for GridArray and TPArray
extern int      GridArray3          = 100;      // than there is for SetArray
extern int      GridArray4          = 0;
extern int      GridArray5          = 0;
extern int      TPArray1            = 50;
extern int      TPArray2            = 100;
extern int      TPArray3            = 200;
extern int      TPArray4            = 0;
extern int      TPArray5            = 0;