Jump to content

Functions in a professionally coded EA/trading robot

Guest EA-trader

Recommended Posts

Guest EA-trader

The following functions are useful in an EA, have them coded.Do you know of any other functions?


//--- Standard parameters
extern double Lots = 2.0;//£2 PER POINT
extern double TradeMaxRisk = 2; // TradeMaxRisk > 0 so much % risk will be used, either based on SL or Account equity
extern bool AutoLot = false;
extern bool AllowSecond = false;
extern int AdvancedProfitManagerBlackout = 60; // 60 minutes wait after the Advanced Profit Manager closes a trade
// First dailyEA1
extern string TRADING_DAYS1AM = "1,2,3,4,5";
extern int StopLossFirst1 = 600; // 0 deactivates Stop Loss
extern int StopLossSecond1 = 600;
extern int StartTrail1 = 300; // Start trail after so many pips.
extern int TrailingStop1 = 250; // 0 deactivates Trailing Stop
extern int TrailStep1 = 30; // With which increments TS moves
// Proportional stop
extern int PropStop1 = 1000; // PropStop follows behind current price by X pips
extern int StartPosition1 = 1650; // Pips profit at which to begin trailing with PropStop
extern double IncrementPercentage1 = 2; // Each pip of profit changes the PropStop value by X percent
extern int MinStopValue1 = 100; // PropStop cannot be less than X
extern int TakeProfit1 = 400; // 0 deactivates Take Profit
extern int GainForBE1 = 200; // How many pips will trigger Break Even. 0 deactivates.
extern int PipsBE1 = 20; // Level at which Break Even will be put
extern int StartTime1 = 130; // Start trading at 7:00
extern int StopTime1 = 1200; // Stop trading at 23:00; Set to StartTime for continous operation (default).
extern int PipGap1 = 100; // Pip gap between first and second entry
extern int TimeGap1 = 30; // Time gap between first and second entry of 30 min
extern int PipsLongEntry1 = -10;
extern int PipsShortEntry1 = 10;
extern string profit="==== Profit Manager ====";
extern int PMTP1 = 1650;
extern bool EnableExitManager = false;
extern double OldSwapLong = 1.0;
extern double OldSwapShort = -1.0;
extern int RangeDeviation = 100;


extern bool UseProbCountsFilter = true; //1 ea with high settings ,secon/forth /seventh/9 th with high settings on second and fourth strategy = msptifilter
extern bool UseProbCountsFilter2 = true;
extern bool UseMSSIFilter = false; // stoch4h
extern bool UsePriceFilter = false;
extern bool UseLWMAFilter = false;
extern bool UseMSEI601Filter = true; // total
extern bool UseConsolidationFilter = false; // oldpm
extern int MinimumPreviousRange = 2;
extern bool Disable_Comments = false; // EA will not display comments on screen
extern string closing="==== Close Times ====";
extern bool CloseOnTime = true;
extern int ClosingTime = 2000;
extern int FridayCloseHour = 19; // Close all pending and open orders on Friday 19.00 hours
extern datetime DisableFrom = D'2016.10.1 11:00:00'; // disable all new trades between 11.00am to 15.00 hours on 1/10/2008
extern datetime DisableTo = D'2016.10.1 15:00:00';
extern bool UseFILEilter = false;
//---- Debugging
extern bool DoScreenShots = true; // Makes screen shots when a trade is open

extern int ExpertID = 6667711;

extern bool UseAdvancedMM = true;//MARTIGALE

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • General Statistics

    • Total Topics
    • Total Posts
    • Total Members
    • Most Online
      10/06/21 10:53

    Newest Member
    Joined 03/02/23 17:38
  • Posts

    • Hi @Mark12 If you are trading shares, you will have the option to place a limit order to sell your existing position. When the market opens, please check if your order level is close to where the market is trading. All the best, OfentseIG
    • We have to wait until Friday to find out if the UK economy skirted a recession.   Richard Snow, foreign exchange analyst at Daily FX, tells IGTV’s Jeremy Naylor that after the third quarter contraction of 0.3%, there is a risk around the incoming data for the fourth quarter. Here he discusses GBP/USD as a trade to go short. But what if GDP comes in slightly higher? Richard says that is likely to be largely academic and that he believes the short trade will prevail. Jeremy Naylor | Writer, London | Publication date: Friday 03 February 2023
    • Breaking News - US NFPs Surge to 517k vs 185k Expectations, Unemployment Rate Falls to 3.4% Feb 3, 2023 | DailyFX Nick Cawley, Senior Strategist Source: Bloomberg   US DOLLAR (DXY) PRICE AND CHART ANALYSIS US NFPs smash expectations in January. US dollar picks up a bid. Total nonfarm payroll employment increased by 517k in January, and the unemployment rate fell to 3.4% according to the US Bureau of Labor Statistics. Hourly earnings also beat expectations. Last month’s NFP figure was also revised higher from 223k to 260k. ‘ Job growth was widespread in January, led by gains in leisure and hospitality, professional and business services, and health care. Employment also increased in government, partially reflecting the return of workers from a strike.’     The Federal Reserve hiked interest rates by 25 basis points at this Wednesday's FOMC meeting, a move fully expected, and priced in by the market. Fed chair Powell, while continuing to stress that further rises are data dependent, added a new word to his FOMC vocabulary, disinflation, sending the US dollar lower and risk markets sharply higher. Powell said that it is a ‘good thing that disinflation so far has not come at expense of labor market’, adding that ‘this disinflationary period is in early stages’. While chair Powell will still keep tightening monetary policy to break the back of inflation, financial markets are now pricing in just one more 25bp rate hike at the March meeting before a pause in Q2 and Q3, while rate cuts are now seen in Q4. FOMC Hikes Rates 25 bps as Expected, Leaves Open Further Hike Expectations The US dollar (DXY) picked up a bid post-release rising around 60 cents to 101.90 US DOLLAR (DXY) DAILY PRICE CHART – FEBRUARY 3, 2023     What is your view on the US Dollar – bullish or bearish?
  • Create New...