Check based on Bull and Bears
Page 1 of 613 123 LastLast
Results 1 to 10 of 23

Thread: Check based on Bull and Bears

  1. #1
    I need a check whats based on bulls and bears.
    I have the basics already:
    extern bool EnableBull = True;

    int BullSignal = EMPTY_VALUE;

    //BULL
    if (EnableBull==True)
    //check1 needed
    BullSignal = OP_SELL
    else
    BullSignal = EMPTY_VALUE;


    I need now add the commend of check required the following.
    When there are 4 or more bullish candles following each other.
    And after these 4 or more bullish candles must be 1 bearish candle, when this bearish candle is shut it needs to open an brief trade.

    In this film you find an example:
    http://www..eu/bla.png

    1: Bullish Candle number one
    2: Bullish Candle number two
    3: Bullish Candle amount three
    4: Bullish Candle amount four
    5: Bearish Candle
    6: Open Short

    The code ought to be something like this I believe:
    If (bull1 = authentic ) (bull2 = authentic ) (bull3 = authentic ) (bull4 = authentic ) (bear = true)
    BullSignal = OP_SELL
    else
    BullSignal = EMPTY_VALUE;


    Someone here which will help me ?

  2. #2
    I am trying it like this today:
    Creating the booleans.
    Inserted Code bool b_bullish; bool b_bullish1; bool r_bullish; bool r_bullish1; Set the booleans on false.
    Inserted Code void bullish() bool b_bullish = false; bool r_bullish = false; bool b_bullish1 = false; bool r_bullish1 = false;
    The check:
    Inserted Code 1 if (EnableBull==True) 2 if (b_bullish = Close#91;#93; gt; Open#91;#93;-RRB- 3 r_bullish = true; 4 else 5 BullSignal = EMPTY_VALUE; 6 7 8 if (r_bullish == true) 9 BullSignal = OP_SELL; 10 else 11 BullSignal = EMPTY_VALUE; 12 13
    However, I get some errors:
    'b_bullish' - left parenthesis anticipated - line two
    ']' - wrong dimension - line two
    '=' - assignment expected - line two
    ']' - semicolon expected - line two
    ']' - unexpected token - line two
    'gt;' - unexpected token - line two
    'Open' - unexpected token - line two
    ']' - wrong dimension - line two
    '{' - assignment expected - line two
    'else' - unexpected token - line 4

    Someone understands whats happening?

  3. #3
    I see that the [ and ] mistakes in the code are since these are used for arrays.
    Anybody here that can help me how it should be done?

  4. #4
    Quote Originally Posted by ;
    I'm trying it like this now:
    Establishing the booleans.
    Inserted Code bool b_bullish; bool b_bullish1; bool r_bullish; bool r_bullish1; Place the booleans on false.
    [code]void bullish() {...
    if (Close[1] gt; Open[0]) {

    for [0] is current bar while [1] is pervious bar

    hope this help

  5. #5
    I am now first detecting what kind of candle is was.
    Inserted Code if (Open#91;1#93; gt; Open#91;0#93;-RRB- Print(Bearish); Once I backtest this I receive this kind of outcomes:
    2010.01.23 13:26:00 2010.01.18 18:58 EA GBPUSD,H1: Bearish
    2010.01.23 13:26:00 2010.01.18 18:57 EA GBPUSD,H1: Bearish
    2010.01.23 13:26:00 2010.01.18 18:56 EA GBPUSD,H1: Bearish
    2010.01.23 13:26:00 2010.01.18 18:55 EA GBPUSD,H1: Bearish
    How can I make it possible it only checks based on the timeframe I use? When it's set on H1 it only assesses on 17:00 | 18:00 | 19:00 etc..

  6. #6
    Quote Originally Posted by ;
    I am currently first detecting what kind of candle is was.
    [code]...
    utilize iOpen/ iClose?
    Dual iOpen( string symbol, int timeframe, int shift)
    Returns Open significance for the pub of signaled symbol with interval and shift. If local history is vacant (not loaded), function returns 0.
    For the current chart, the information about open prices is at the predefined array named Open[].

  7. #7
    Hmm Once I Perform the following:
    Inserted Code double opencheck = 0.0; double closecheck = 0.0; if (EnableBull==True) opencheck = iOpen(GBPUSD,60,0); closecheck = iClose(GBPUSD,60,0); if (opencheck gt; closecheck) Print(Bearish); if (opencheck lt; closecheck) Print(Bullish); I still get with backtesting these kind of Outcomes:
    2010.01.23 13:26:00 2010.01.18 18:58 EA GBPUSD,H1: Bearish
    2010.01.23 13:26:00 2010.01.18 18:57 EA GBPUSD,H1: Bearish
    2010.01.23 13:26:00 2010.01.18 18:56 EA GBPUSD,H1: Bearish
    2010.01.23 13:26:00 2010.01.18 18:55 EA GBPUSD,H1: Bearish

    Do I something wrong:S?

  8. #8
    Quote Originally Posted by ;
    Hmm when I do the following:
    [code]
    double opencheck...
    you're checking the current bar of H1?

  9. #9
    While I use the following code:
    Inserted Code opencheck = iOpen(GBPUSD,PERIOD_H1,0); closecheck = iClose(GBPUSD,PERIOD_H1,0); when (opencheck lt; closecheck) Print(It Can Be Really a Bullish Candle); BullSignal = EMPTY_VALUE; if (opencheck gt; closecheck) Print(This is Really a Bearish Candle); BullSignal = EMPTY_VALUE; I Receive the results of the currentbar of every tick.

    But now I want that the moment this pub closes it sets a factor on true.
    Because when I create it like this:
    Inserted Code opencheck = iOpen(GBPUSD,PERIOD_H1,0); closecheck = iClose(GBPUSD,PERIOD_H1,0); when (opencheck lt; closecheck) Print(This can be a Bullish Candle); #91;b#93;bull = true;#91;/b#93; BullSignal = EMPTY_VALUE; if (opencheck gt; closecheck) Print(This is a Bearish Candle); BullSignal = EMPTY_VALUE; It will set this variable every tick when opencheck is smaller then that the closecheck on true. But I really don't what that, I want that the factor called bull, just will be set on true the moment the bar is closed, and when opencheck is smaller then closecheck.

  10. #10
    Use iBars(NULL,TimeFrame)

    by way of example

    Inserted Code int LastBar; int init() LastBar = iBars(NULL,PERIOD_H4); int begin () if(LastBar ! ) = iBars(NULL,PERIOD_H4)) LastBar = iBars(NULL,PERIOD_H4); Printing (New H4 Bar); //checking candle begin //... //checking candle finish

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.