Need Help With Script PLEASE
Results 1 to 4 of 4

Thread: Need Help With Script PLEASE

  1. #1
    I've got this script I want to add A trailing stop enter. And also a input to lock pips. For instance say I set my TP in 50 pips and TS in 20 I want a enter where I could place in state 5 pips when the market reverses, and also a input on the number of pips the market must proceed to activate the lock profit. I have a buy sell and quick reverse within this zip, if somebody could program one of those afterward I could copy the code for the others. I sur may use any help on this.

    Thanks Far,
    Mike

    https://www.nigeriaforextrading.com/...1352009601.zip

  2. #2
    Here is the code I want altered in my post I sure can use this and that I believe everybody here could utilize it to be profitable.
    Thank You
    Mike


    //p-------------------------------------------------------------------------
    //| IBFX - Quick Buy.mq4 |
    // -------------------------------------------------------------------------
    //--
    int begin()

    // -------------------------------------------------------------------------
    //-- A couple tests before we get started
    if(! IsConnected() ) Alert( Commentary - No Link!! ) ; return(0);

    //-- Particular Vars
    int Action = OP_BUY;
    double InitPrice = Ask;

    //-- Worldwide Vars
    bool Done = False;
    string Symbole = Symbol();
    int Ticket = 0;
    int ErrorCode = 0;
    double MaxLots = MarketInfo(Symbole, MODE_MAXLOT);
    double Lots =MM(Symbole, Risk, MiniLots);


    //-- Let's place the order.
    while( ! Done)
    Placing Long Order, please wait ...);
    Wait();
    Ticket = OrderSend(Symbole, Action, Lots, FillPrice, Slippage * Point, StopLong(StopPrice, StopLoss), TakeLong(FillPrice, ProfitTarget), Commentary, MagicNumber, 0, CLR_NONE);
    if(Ticket gt;= 0) Done = true;
    else

    ErrorCode = GetLastError();
    if(ErrorCode == 4109) Alert(Commentary - You did not allow live trading!)) ; s true;
    else if(ErrorCode == 134) Alert(Commentary - Not enough Cash! ) ; Done = true;
    else if(ErrorCode == 138

    Opinion();

    //--
    return(0);

    // -------------------------------------------------------------------------
    // -------------------------------------------------------------------------
    // Wait
    // -------------------------------------------------------------------------
    void Wait() while(IsTradeContextBusy()) Sleep(50);
    // -------------------------------------------------------------------------
    // -------------------------------------------------------------------------
    //| Calculate Cease Short |
    // -------------------------------------------------------------------------
    double StopLong(double price,int stop)

    if(stop==0) return(0);
    else return(price-(stop*Point));

    // -------------------------------------------------------------------------
    //| Calculate Profit Goal Extended |
    // -------------------------------------------------------------------------
    double TakeLong(double price,int take)

    if(accept==0) return(0);
    else return(price (take*Point));

    // -------------------------------------------------------------------------
    // -------------------------------------------------------------------------
    //| Cash Managment |
    // -------------------------------------------------------------------------
    double MM(string Sym, double Risk, bool BrokerAllowsFractionalLots)

    double MinLots = MarketInfo(Sym,MODE_MINLOT);
    double MaxLots = MarketInfo(Sym,MODE_MAXLOT);
    double Leverage = AccountLeverage();
    double LotSize = MarketInfo(Sym,MODE_LOTSIZE);
    double LotStep = MarketInfo(Sym,MODE_LOTSTEP);

    double FinalAccountBalance = MathMin(AccountBalance(), AccountEquity());
    int NormalizationFactor = 0;
    double Lots = 0.0;

    if(LotStep == 0.01) NormalizationFactor = two;
    if(LotStep == 0.1) NormalizationFactor = 1;

    if(BrokerAllowsFractionalLots == true)

    Lots = (FinalAccountBalance*(Risk/100.0))/(LotSize/Leverage);
    Lots = StrToDouble(DoubleToStr(Lots, NormalizationFactor));
    if (Lots lt; MinLots) Lots = MinLots;
    if (Lots gt; MaxLots) Lots = MaxLots;

    else if(BrokerAllowsFractionalLots == false)

    Lots = (FinalAccountBalance*(Risk/100.0))/(LotSize/Leverage);
    Lots = MathRound(Lots);
    if (Lots lt; MinLots) Lots = MinLots;
    if (Lots gt; MaxLots) Lots = MaxLots;

    return(Lots);

  3. #3
    Ok Thanks I shall come across an ea...

  4. #4
    Hey mike.... Kinda figured someone would have replied by now....

    //------

    that is not the way scripts work.... If you'd like a tracking stop or any such action you're going to want a true ea.... not a script...h

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.