Check based on Bull and Bears - Page 2
Page 2 of 613 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: Check based on Bull and Bears

  1. #11
    Inserted Code int COUNT = 0; for( int I = 5; I gt; 1; I--) if(Close#91;I#93; gt; Open#91;I#93;-RRB- COUNT = COUNT 1; else COUNT = COUNT - 1; if( COUNT == 4 Close#91;1#93; lt; Open#91;1#93; ) SHORT TRIGGER if( COUNT == -4 Close#91;1#93; gt; Open#91;1#93; ) LONG TRIGGER
    Does this help?

  2. #12
    Quote Originally Posted by ;
    Inserted Code int COUNT = 0; for( int I = 5; I gt; 1; I--) if(Close#91;I#93; gt; Open#91;t #93;-RRB- COUNT = COUNT 1; else COUNT = COUNT - 1; if( COUNT == 4 Close#91;1#93; lt; Open#91;1#93; ) SHORT TRIGGER if( COUNT == -4 Close#91;1#93; gt; Open#91;1#93; ) LONG TRIGGER Does that help?
    Could you tell exactly what it precisely does line for line, so I can understand that the code?

    I have the code now similar to this:
    Inserted Code int COUNT = 0; for( int I = 5; I gt; 1; I--) if(Close#91;t #93; gt; Open#91;I#93;-RRB- COUNT = COUNT 1; else COUNT = COUNT - 1; if (EnableBull==True) if (COUNT == 4 Close#91;1#93; lt; Open#91;1#93;-RRB- BullSignal=OP_BUY; if (EnableBears==True) if (COUNT == -4 Close#91;1#93; gt; Open#91;1#93;-RRB- BearSignal=OP_SELL; And when I backtest it get this order:
    1 2009.01.05 00:00 sell 1 0.10 1.4542 0.0000 0.0000 0.00 10000.00
    2 2009.01.05 00:00 modify 1 0.10 1.4542 0.0000 1.4462 0.00 10000.00
    3 2009.01.05 00:57 modify 1 0.10 1.4542 1.4541 1.4462 0.00 10000.00
    4 2009.01.05 00:58 modify 1 0.10 1.4542 1.4540 1.4462 0.00 10000.00
    5 2009.01.05 01:00 modify 1 0.10 1.4542 1.4539 1.4462 0.00 10000.00
    6 2009.01.05 01:02 modify 1 0.10 1.4542 1.4536 1.4462 0.00 10000.00
    7 2009.01.05 01:03 close 1 0.10 1.4506 1.4536 1.4462 36.00 10036.00

    And this really is a screenshot of that order:
    http://www..eu/bla2.png
    As we can see it opened the order at number 5, but if we examine my first post it should open the order at number 6.
    If we go back to my principles I said when you will find 4 bearish candles, then wait until the following candle is shut, is this a bullish candle, then open a Short trade.
    This that final check is not done.

    But there aren't always 4 bearish of bullish candles, occasionally you will find more as we can see in this film.
    Http://www..eu/bla3.png

    Here we visit 7 bearish candles in a row. And after those 7 bearish candle there's a bullish candle at number 8.
    And when the candle at number 9 openend it must begin a Short trade.
    Following the Short trade is made that the market was going down as we can see in the following picture.
    Http://www..eu/bla4.png

    And we might have earned at least 50pips.

  3. #13
    In this instance, u don't need to count how many bullish prior to the bearish...

    your condition ought to be:
    just search for the previous five bars

    if(bar2 into bar5== bullish bar1 ==bearish) activate buy at Open[0])

    that is the logic of your system

  4. #14
    For starters, you have the candles plotted backward. The MT4 convention is that the current candle and the previous candle is 1.

    The code I submitted checks candles 5,4,3,2 and outlines the number of are bullish and the number of are bearish. If all 4 are bullish and candle 1 is bearish, then it's a brief trigger.

    Ensure you reset your factors at the same time you set COUNT to 0. I have a feeling.
    Inserted Code // reset factors BullSignal= BearSignal= int COUNT = 0; / / / count candles 2 through 5 for( int I = 5; I gt; 1; I--) if(Close#91;I#93; gt; Open#91;I#93;-RRB- COUNT = COUNT 1; else COUNT = COUNT - 1; // test for extended if (EnableBull==True) if (COUNT == -4 Close#91;1#93; gt; Open#91;1#93;-RRB- BullSignal=OP_BUY; // test for brief if (EnableBears==True) if (COUNT == 4 Close#91;1#93; lt; Open#91;1#93;-RRB- BearSignal=OP_SELL;
    You also had the bulls/bears reversed.

  5. #15
    I have it now like that:
    I have put the following code in the start of my code even before int init().
    Inserted Code int COUNT = 0; int BBSignal = EMPTY_VALUE; And this code is set in the: int start() part.
    Inserted Code for (int I = 5; I gt; 1; I--) if(Close#91;t #93; gt; Open#91;t #93;-RRB- COUNT = COUNT 1; else COUNT = COUNT - 1; if (EnableBB==True) if (COUNT == 4 Close#91;1#93; lt; Open#91;1#93;-RRB- BBSignal=OP_BUY; if (EnableBB==True) if (COUNT == -4 Close#91;1#93; gt; Open#91;1#93;-RRB- BBSignal=OP_SELL; And backtesting I got this effect:
    http://www..eu/bla6.png

    It started at first a LONG commerce and It Needs to Be a SHORT trade. And that instant LONG trade shouldn't even be there.

    I put the codeint COUNT = 0; now almost everywhere in the code but I can not figure it out exactly what's going wrong.
    I have put it as explained above, I have test it to put it until the for loop: for (int I = 5; I gt; 1; I--) {

    If have checked what happend when I put: COUNT = 0:
    After BBSignal=OP_BUY and BBSignal=OP_SELL, but that didn't solve the issue.

  6. #16
    A little upgrade.

    I am currently just a bit farther, it opens at the right time according the requirements.
    Only after that trade it doen't set the factor BBSignal back to EMPTY_VALUE. So it keeps saying OP_BUY or OP_SELL based what was initially.
    Once the initial order is finished, it keeps saying OP_BUY/OP_SELL. When when the initial order is finished, in the next subsequent candle it opens a new order. If this order is done it resets BBSignal out of OP_BUY/OP_SELL back to EMPTY_VALUE.
    I have really no clue what is going wrong and why he does so.
    I have placed the code BBSignal = EMPTY_VALUE; at a few points where I think it solved the problem but it was not. Some cases of where I placed the code BBSignal = EMPTY_VALUE; are right behind the stage it opens an order, or when it'll be closed.

    I have the code today like this:
    Inserted Code int BBSignal = EMPTY_VALUE; int startbuy = EMPTY_VALUE; int startsell = EMPTY_VALUE; if (EnableBB==True) if(Close#91;two 93; lt; Open#91;two #93; Close#91;two 1#93; lt; Open#91;two 1#93; Close#91;2 2#93; lt; Open#91;2 2#93; Close#91;2 3#93; lt; Open#91;2 3#93;-RRB- if(Close#91;1#93; gt; Open#91;1#93; Open#91;1#93;! = startbuy) bbsignal_buy(); if(Close#91;two #93; gt; Open#91;two #93; Close#91;two 1#93; gt; Open#91;two 1#93; Close#91;2 2#93; gt; Open#91;2 2#93; Close#91;2 3#93; gt; Open#91;2 3#93;-RRB- if(Close#91;1#93; lt; Open#91;1#93; Open#91;1#93;! = startsell) bbsignal_sell(); void bbsignal_buy() BBSignal=OP_BUY; startbuy = Open#91;0#93;; emptiness bbsignal_sell() BBSignal=OP_SELL; startsell = Open#91;0#93;; Someone that has an idea how to solve this?

  7. #17
    Quote Originally Posted by ;
    A little update.

    [/code]Somebody that has an idea how to solve this?
    I think that is what you desire.

    Test it. I simply make a code.
    Hope it helps.
    https://www.nigeriaforextrading.com/...1527266270.mq4
    https://www.nigeriaforextrading.com/...1792041761.ex4

  8. #18
    Quote Originally Posted by ;
    I feel this is exactly what you want.

    Test it. I make a code that is fast.
    Hope it helps.
    I receive an OrderSend error 130.

    Edit:

    I put your way in my EA like that:
    Inserted Code bool NewBar() static datetime lastbar = 0; datetime curbar = Time#91;0#93;; if(lastbar! =curbar) lastbar=curbar; return (true); else return(false); if (EnableBB==True) if(NewBar()) if( Close#91;5#93;gt;Open#91;5#93; Close#91;4#93;gt;Open#91;4#93; Close#91;3#93;gt;Open#91;3#93; Close#91;two #93;gt;Open#91;two #93; Close#91;1#93;lt;Open#91;1#93;-RRB- BBSignal=OP_SELL; if( Close#91;5#93;lt;Open#91;5#93; Close#91;4#93;lt;Open#91;4#93; Close#91;3#93;lt;Open#91;3#93; Close#91;two #93;lt;Open#91;two #93; Close#91;1#93;gt;Open#91;1#93;-RRB- BBSignal=OP_BUY;
    Plus it seems to work

  9. #19
    Quote Originally Posted by ;
    I get an OrderSend error 130.

    Edit:

    I put your way in my EA like this:
    [code]
    bool NewBar()
    {...
    the ordersend error because of price digit I think..anyway. .good it works for you. . .Is it profitable?

  10. #20
    Quote Originally Posted by ;
    the ordersend error due to price I think..anyway. .good it works for you. . .Is it profitable?
    If I fix some tiny mistakes in the code etc like this one below, I believe it will be profitable.

    I have a bit rules here:
    Inserted Code if(TimeDayOfWeek(cur_time) == 0 || TimeDayOfWeek(cur_time) == 6) text StringConenate(nTrading on Saturday/Sunday (local time) is disabled, so no trading today.,text); is_trading_time = false; How do I fix that in this code it also will not trade before monday 6:00?

    And I really don't need it in this principle:
    Inserted Code if(! TradeOnMonday day_of_week lt;= 1) text StringConenate(nTrading on Monday is handicapped, so no trading today.,text); is_trading_time = false; Since this one blocks all trade signs on monday.

    Edit:
    Fixed together:
    Inserted Code extern bool DontTradeOnMondayBefore6 = True; if (DontTradeOnMondayBefore6 day_of_week lt;= 1 Hour() lt;= 6) text = StringConenate(nTrading on Monday before 6:00 is handicapped, so no trading today.,text); is_trading_time = false;

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.