Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23
 2 Attachment(s)    

Thread: Lots Multiplier( help Please)

  1. #11
    joepayne
    Guest

    Default

    Thanks. It is tarting to work!!!
    I have added 2 extra moving averages. it is making profit on the 5 min chart, if I set the stop loss to 30 and take profit to 50 and works better on 15 min chart stop loss at 50 profit on 100. now I need to add 2 more averages but one must be a 100 exponential moving average and the other must be a 100 simple moving average. I don't know how to define the different 2

    this is what I have added:

    double Buy1_1 = iADX(NULL, 0, 5, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Buy1_2 = iADX(NULL, 0, 6, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Buy1_3 = iADX(NULL, 0, 13, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Buy1_4 = iADX(NULL, 0, 21, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Buy1_5 = iADX(NULL, 0,100 exponential, PRICE_CLOSE, MODE_MAIN, Current + 0); <-------- need
    double Buy1_6 = iADX(NULL, 0,100 simple, PRICE_CLOSE, MODE_MAIN, Current + 0); <-------- need

    double Sell1_1 = iADX(NULL, 0, 5, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Sell1_2 = iADX(NULL, 0, 6, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Sell1_3 = iADX(NULL, 0, 13, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Sell1_4 = iADX(NULL, 0, 21, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Sell1_5 = iADX(NULL, 0,100 exponential, PRICE_CLOSE, MODE_MAIN, Current + 0); <-------- need
    double Sell1_6 = iADX(NULL, 0,100 simple, PRICE_CLOSE, MODE_MAIN, Current + 0); <-------- need

    if (Buy1_1 > Buy1_2) Order = SIGNAL_BUY;
    if (Buy1_3 < Buy1_4) Order = SIGNAL_NONE;
    if (Buy1_5 < Buy1_6) Order = SIGNAL_NONE; <-------- need

    if (Sell1_1 < Sell1_2) Order = SIGNAL_SELL;
    if (Sell1_3 > Sell1_4) Order = SIGNAL_NONE;
    if (Sell1_5 > Sell1_6) Order = SIGNAL_NONE; <-------- need


    thanks
    Joe
    Last edited by joepayne; 05-28-2010 at 09:28.

  2. #12
    joepayne
    Guest

    Default

    check this out:

    if i use:
    double Buy1_1 = iADX(NULL, 0, 6, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Buy1_2 = iADX(NULL, 0, 5, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Buy1_3 = iADX(NULL, 0, 13, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Buy1_4 = iADX(NULL, 0, 21, PRICE_CLOSE, MODE_MAIN, Current + 0);

    double Sell1_1 = iADX(NULL, 0, 6, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Sell1_2 = iADX(NULL, 0, 5, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Sell1_3 = iADX(NULL, 0, 13, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Sell1_4 = iADX(NULL, 0, 21, PRICE_CLOSE, MODE_MAIN, Current + 0);

    on the EURUSD 15 min , stoploss to 50, takeprofit to 30, lots on 0.2,max lots to 3, with 1000 USD I end up with 2572.92 USD for May up on till the 28th.
    Is this EA then worth using?????

  3. #13
    Junior Member
    Join Date
    Mar 2009
    Posts
    14

    Default

    Hi Joe,

    You mention moving averages but you are using ADX which is something different. If you want a moving average, you should be using iMA rather. What do you want the moving average to do?

  4. #14
    joepayne
    Guest

    Default

    actualy all of it must be moving averages: if 5 cross 6 upwards buy signal but if 13 did not cross 21 up no buy signal. and if 5 cross 6 downwards sell signal but if 13 did not cross 21 down no buy signal.

    and a other thing the EA don't want to make real trades? 2010.05.28 18:21:42 M15: Error getting EURUSD15Method

  5. #15
    Junior Member
    Join Date
    Mar 2009
    Posts
    14

    Default

    Ok, and does that apply to the 100 EMA & 100 SMA? Shoud the 5 & 6 as well as the 13 & 21 be SMA or EMA? Also, is the cross significant or must they simply be above(or below for a short)?

  6. #16
    joepayne
    Guest

    Default

    Yes, if the 100 EMA is below the 100 SMA it is indicating that it is a overall short trend and vice verse, can have the function to be enabled or disabled(It might be an extra indication,might work or might not work) . no the rest must be SMA's. the trade must take place when the 5 crosses(TRADE TRIGER) the 6 and check if the 13 is above 21 or below. if the 5 crosses the 6 downwards it must check to see if 13 is below 21 and if 100 EMA is below the 100 SMA if so trade sell, if not no trade. and if the 5 crosses the 6 upwards it must check to see if 13 is above 21 and if 100 EMA is above the 100 SMA if so trade, if not no trade. only the 5 & 6 is significant it must start the trade.

    13 and 21 can also have the function to be enabled or disabled



    This is what I got so far!!!! If I can only make the loss count to be between 2 and 3 then this EA will work the way I want it to!!!!!!!!!!
    Attached Files Attached Files
    Last edited by joepayne; 05-29-2010 at 07:46.

  7. #17
    Junior Member
    Join Date
    Mar 2009
    Posts
    14

    Default

    You posted the ex4 file, which I can't use..........anyway, here is the gist of the code that you need. I have not tested it, so play around with it a bit.

    PHP Code:
    int Signal_1()//check that 13 SMA is above or below 21 SMA >>> return 0 for a buy and 1 for a sell
    {
       if(
    iMA(Symbol(),0,13,0,MODE_SMA,PRICE_CLOSE,1) > iMA(Symbol(),0,21,0,MODE_SMA,PRICE_CLOSE,1)return(1);
       if(
    iMA(Symbol(),0,13,0,MODE_SMA,PRICE_CLOSE,1) < iMA(Symbol(),0,21,0,MODE_SMA,PRICE_CLOSE,1)return(-1);
       return(
    NO_RESULT);   
    }
    //+------------------------------------------------------------------+
    int Signal_2()//check for cross of the 5 SMA above or below the 6 SMA >>>> return 0 for a buy and 1 for a sell
    {
       if(
    iMA(Symbol(),0,5,0,MODE_SMA,PRICE_CLOSE,0) > iMA(Symbol(),0,6,0,MODE_SMA,PRICE_CLOSE,0){
          if(
    iMA(Symbol(),0,5,0,MODE_SMA,PRICE_CLOSE,1) < iMA(Symbol(),0,6,0,MODE_SMA,PRICE_CLOSE,1)return(1);
       }
       if(
    iMA(Symbol(),0,5,0,MODE_SMA,PRICE_CLOSE,0) < iMA(Symbol(),0,6,0,MODE_SMA,PRICE_CLOSE,0){
          if(
    iMA(Symbol(),0,5,0,MODE_SMA,PRICE_CLOSE,1) > iMA(Symbol(),0,6,0,MODE_SMA,PRICE_CLOSE,1)return(-1);
       }
       return(
    NO_RESULT);
    }
    //+------------------------------------------------------------------+
    int Signal_3()//check that 100 EMA is above or below 100 SMA >>>> return 0 for a buy and 1 for a sell
    {
       if(
    iMA(Symbol(),0,100,0,MODE_EMA,PRICE_CLOSE,0) > iMA(Symbol(),0,100,0,MODE_SMA,PRICE_CLOSE,0)return(1);
       if(
    iMA(Symbol(),0,100,0,MODE_EMA,PRICE_CLOSE,0) < iMA(Symbol(),0,21,0,MODE_SMA,PRICE_CLOSE,0)return(-1);
       return(
    NO_RESULT);   
    }
    //+------------------------------------------------------------------+
    int 
       Signal_Result 
    Signal_1 Signal_2;
       if(
    Use_100_EMA) {
          
    Signal_Result =+ Signal_3;
          if (
    Signal_Result 3Order SIGNAL_BUY;
          if (
    Signal_Result = -3Order SIGNAL_SELL;
       }
       else{
          if (
    Signal_Result 3Order SIGNAL_BUY;
          if (
    Signal_Result = -3Order SIGNAL_SELL;
       } 
    At the top put this line of code in :-

    #define NO_RESULT -1000

    It is pretty simple, you have 3 signals, each return a value of either 1 for a buy or -1 for a sell. If there is no trade, it returns a -1000. So if all signals return a buy, you will have 3 x 1 = 3 so we know we have 3 buy signals concurring. If any of the signals do not return 1 the sum of the 3 cannot be zero.

    Same for a sell.....if you have 3 sell signals in agreement, the sum of the three is -33. If any of them do not agree, you will have less than either more than 3 or almost -1000 but not -3.

    BTW, you need to put the bool Use_100_EMA in your extern variables section.

    Hope it helps.
    Last edited by kennyhubbard; 05-29-2010 at 08:31.

  8. #18
    joepayne
    Guest

    Default

    I found that the previous EA works best on the 15 min chart.take loss to 50 take profit to 30 I just cant get it to work on real trading. and I also found on test that it still multiplies even if I set the max_lots to to 1 or 2


    #define SIGNAL_NONE 0
    #define SIGNAL_BUY 1
    #define SIGNAL_SELL 2
    #define SIGNAL_CLOSEBUY 3
    #define SIGNAL_CLOSESELL 4



    extern int MagicNumber = 0;
    extern bool SignalMail = False;
    extern bool EachTickMode = True;
    extern double Lots = 0.1;
    extern double Lot_Increment = 2;
    extern int Slippage = 3;
    extern bool UseStopLoss = True;
    extern int StopLoss = 10;
    extern bool UseTakeProfit = True;
    extern int TakeProfit = 10;
    extern bool UseTrailingStop = False;
    extern int TrailingStop = 30;
    extern int Max_Lots = 2;

    int BarCount;
    int Current;
    bool TickCheck = False;
    int LotDigits = 1;
    //+------------------------------------------------------------------+
    //| expert initialization function |
    //+------------------------------------------------------------------+
    int init() {
    BarCount = Bars;

    if (EachTickMode) Current = 0; else Current = 1;
    if (MarketInfo(Symbol(),MODE_LOTSTEP) == 0.01) LotDigits = 2;

    return(0);
    }
    //+------------------------------------------------------------------+
    //| expert deinitialization function |
    //+------------------------------------------------------------------+
    int deinit() {
    return(0);
    }
    //+------------------------------------------------------------------+
    //| expert start function |
    //+------------------------------------------------------------------+
    int start() {
    int Order = SIGNAL_NONE;
    int Total, Ticket;
    double StopLossLevel, TakeProfitLevel;



    if (EachTickMode && Bars != BarCount) TickCheck = False;
    Total = OrdersTotal();
    Order = SIGNAL_NONE;

    //+------------------------------------------------------------------+
    //| Variable Begin |
    //+------------------------------------------------------------------+


    double Buy1_1 = iADX(NULL, 0, 6, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Buy1_2 = iADX(NULL, 0, 5, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Buy1_3 = iADX(NULL, 0, 13, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Buy1_4 = iADX(NULL, 0, 21, PRICE_CLOSE, MODE_MAIN, Current + 0);

    double Sell1_1 = iADX(NULL, 0, 6, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Sell1_2 = iADX(NULL, 0, 5, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Sell1_3 = iADX(NULL, 0, 13, PRICE_CLOSE, MODE_MAIN, Current + 0);
    double Sell1_4 = iADX(NULL, 0, 21, PRICE_CLOSE, MODE_MAIN, Current + 0);


    //+------------------------------------------------------------------+
    //| Variable End |
    //+------------------------------------------------------------------+

    //Check position
    bool IsTrade = False;

    for (int i = 0; i < Total; i ++) {
    OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
    if(OrderType() <= OP_SELL && OrderSymbol() == Symbol()) {
    IsTrade = True;
    if(OrderType() == OP_BUY) {
    //Close

    //+------------------------------------------------------------------+
    //| Signal Begin(Exit Buy) |
    //+------------------------------------------------------------------+



    //+------------------------------------------------------------------+
    //| Signal End(Exit Buy) |
    //+------------------------------------------------------------------+

    if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
    OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen);
    if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy");
    if (!EachTickMode) BarCount = Bars;
    IsTrade = False;
    continue;
    }
    //Trailing stop
    if(UseTrailingStop && TrailingStop > 0) {
    if(Bid - OrderOpenPrice() > Point * TrailingStop) {
    if(OrderStopLoss() < Bid - Point * TrailingStop) {
    OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen);
    if (!EachTickMode) BarCount = Bars;
    continue;
    }
    }
    }
    } else {
    //Close

    //+------------------------------------------------------------------+
    //| Signal Begin(Exit Sell) |
    //+------------------------------------------------------------------+



    //+------------------------------------------------------------------+
    //| Signal End(Exit Sell) |
    //+------------------------------------------------------------------+

    if (Order == SIGNAL_CLOSESELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
    OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, DarkOrange);
    if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Close Sell");
    if (!EachTickMode) BarCount = Bars;
    IsTrade = False;
    continue;
    }
    //Trailing stop
    if(UseTrailingStop && TrailingStop > 0) {
    if((OrderOpenPrice() - Ask) > (Point * TrailingStop)) {
    if((OrderStopLoss() > (Ask + Point * TrailingStop)) || (OrderStopLoss() == 0)) {
    OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * TrailingStop, OrderTakeProfit(), 0, DarkOrange);
    if (!EachTickMode) BarCount = Bars;
    continue;
    }
    }
    }
    }
    }
    }

    //+------------------------------------------------------------------+
    //| Signal Begin(Entry) |
    //+------------------------------------------------------------------+

    if (Buy1_1 > Buy1_2) Order = SIGNAL_BUY;
    if (Buy1_3 < Buy1_4) Order = SIGNAL_NONE;

    if (Sell1_1 < Sell1_2) Order = SIGNAL_SELL;
    if (Sell1_3 > Sell1_4) Order = SIGNAL_NONE;

    //+------------------------------------------------------------------+
    //| Signal End |
    //+------------------------------------------------------------------+

    //Buy
    if (Order == SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
    if(!IsTrade) {
    //Check free margin
    if (AccountFreeMargin() < (1000 * Lots)) {
    Print("We have no money. Free Margin = ", AccountFreeMargin());
    return(0);
    }

    if (UseStopLoss) StopLossLevel = Ask - StopLoss * Point; else StopLossLevel = 0.0;
    if (UseTakeProfit) TakeProfitLevel = Ask + TakeProfit * Point; else TakeProfitLevel = 0.0;

    Ticket = OrderSend(Symbol(), OP_BUY, Get_Lots(), Ask, Slippage, StopLossLevel, TakeProfitLevel, "Buy(#" + MagicNumber + ")", MagicNumber, 0, DodgerBlue);
    if(Ticket > 0) {
    if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
    Print("BUY order opened : ", OrderOpenPrice());
    if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Open Buy");
    } else {
    Print("Error opening BUY order : ", GetLastError());
    }
    }
    if (EachTickMode) TickCheck = True;
    if (!EachTickMode) BarCount = Bars;
    return(0);
    }
    }

    //Sell
    if (Order == SIGNAL_SELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
    if(!IsTrade) {
    //Check free margin
    if (AccountFreeMargin() < (1000 * Lots)) {
    Print("We have no money. Free Margin = ", AccountFreeMargin());
    return(0);
    }

    if (UseStopLoss) StopLossLevel = Bid + StopLoss * Point; else StopLossLevel = 0.0;
    if (UseTakeProfit) TakeProfitLevel = Bid - TakeProfit * Point; else TakeProfitLevel = 0.0;

    Ticket = OrderSend(Symbol(), OP_SELL, Get_Lots(), Bid, Slippage, StopLossLevel, TakeProfitLevel, "Sell(#" + MagicNumber + ")", MagicNumber, 0, DeepPink);
    if(Ticket > 0) {
    if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
    Print("SELL order opened : ", OrderOpenPrice());
    if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Open Sell");
    } else {
    Print("Error opening SELL order : ", GetLastError());
    }
    }
    if (EachTickMode) TickCheck = True;
    if (!EachTickMode) BarCount = Bars;
    return(0);
    }
    }

    if (!EachTickMode) BarCount = Bars;

    return(0);
    }
    //+------------------------------------------------------------------+
    double Get_Lots()
    {
    if(OrderSelect(OrdersHistoryTotal()-1,SELECT_BY_POS,MODE_HISTORY)){
    if(OrderProfit() < 0)double lLots = OrderLots() * Lot_Increment;
    else lLots = Lots;

    }
    else lLots = Lots;
    if(lLots > Max_Lots)lLots = Lots;
    return(NormalizeDouble(lLots, LotDigits));

    }

  9. #19
    joepayne
    Guest

    Default

    Do u know of a nother EA that the Roulette system might work on

  10. #20
    Junior Member
    Join Date
    Mar 2009
    Posts
    14

    Default

    Quote Originally Posted by joepayne View Post
    Do u know of a nother EA that the Roulette system might work on
    Joe, the martingale system cannot make a losing system into a winner. At best it can delay the inevitable and when it bites, it bites hard. I like EA's that use sensible variable lotsizes, so when the trade is in your favour(eg after a loss with a system that has a 70% winrate) and you want to double your bet, that is good, but to continue increasing the lotsizes is suicide. You may try and limit the max lotsize but you will find that if the original entry is bad then you will eventually lose.

    What a lot of people underestimate with these systems is how quickly your exposure to the market grows. By way of example if you keep the lotsizes the same for all trades and continue to open trades every x number of pips, your exposure grows exponentially......if you increase the size of your trades, the exposure grows exponentially squared(if that makes sense).

    My suggestion is to find a trade system that works and then MAYBE look at some form of cost averaging to enhance the returns.

Similar Threads

  1. help with multiplier profit EA
    By arbus in forum Ideas for expert advisors
    Replies: 2
    Last Post: 07-28-2011, 16:27
  2. StopLoss & TakeProfit using range/multiplier
    By jidonk in forum MQL programming
    Replies: 0
    Last Post: 01-12-2010, 05:32
  3. Change lots/multiplier to lots=0.01 gives OrderSend error 130?
    By sleepypipsCDN in forum MQL programming
    Replies: 7
    Last Post: 04-12-2009, 09:17
  4. Mini Lots - Micro Lots
    By funyoo in forum Trading discussion
    Replies: 0
    Last Post: 01-23-2009, 12:06

Tags for this Thread

100, adx, ea works, eurusd, ex4, expert, forex, free, how to, magic, main, martingale, profit, profitable, programming, real, signal, signals, simple, slippage, sma, stop, stoploss, system, systems, test, time, trading, trend

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •