Ichimoku Cloud

 
Hi im having some trouble coding with the ichimoku cloud I want to only use the up and down kumo simulating the cloud, Im not sure how to go about this. 
void OnTick()
  {
  //signal Variable
   string signal = "";
      
      //indicators
      double Cloud = iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, 1);
      double MovingAverage = iMA(NULL, 0, 200, 0, MODE_SMA, PRICE_CLOSE, 1);
      
      double K0 = iStochastic (NULL, 0, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 0);
      double K1 = iStochastic (NULL, 0, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 1);
      
      double D0 = iStochastic (NULL, 0, 5, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 0);
      double D1 = iStochastic (NULL, 0, 5, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 1);
      
      //Sell Signal
         if (PRICE_CLOSE < MovingAverage)
         if (PRICE_CLOSE < Cloud)
         if ((K0 > 50) && (D0 > 50))
         if ((D0 > K0) && (D1 < K1))
         {
            signal = "sell";
         }
          
      //Buy signal
         if (PRICE_CLOSE > MovingAverage)
         if (PRICE_CLOSE > Cloud)
         if ((K0 < 50) && (D0 < 50))
         if ((D0 < K0) && (D1 > K1))
         {
            signal = "buy";
         }
         
      // Buy 10 MicroLot
      if (signal=="buy" && OrdersTotal()==0)
      OrderSend (_Symbol, OP_BUY, 0.10, Ask, 3, 0, Ask+12*_Point, NULL, 0,0,clrAliceBlue);
      
      //Sell 10 MicroLot
      if (signal=="sell" && OrdersTotal()==0)
      OrderSend (_Symbol, OP_SELL, 0.10, Bid, 3, 0, Bid-12*_Point, NULL, 0,0, clrRed);
      
      // Chart output of Signal
      Comment ("The current signal is: ", signal);
     
  }
Also this code is only taking sell positions 
 
double Cloud = iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, 1)

Why are you getting the Tenkansen value when you want the cloud?

if (PRICE_CLOSE < MovingAverage)

PRICE_CLOSE is an enum, not a price.


Topics concerning MT4 and MQL4 have their own section.

In future please post in the correct section.

I have moved your topic to the MQL4 and Metatrader 4 section.


 
Keith Watford:

Why are you getting the Tenkansen value when you want the cloud?

PRICE_CLOSE is an enum, not a price.


Topics concerning MT4 and MQL4 have their own section.

In future please post in the correct section.

I have moved your topic to the MQL4 and Metatrader 4 section.


Thanks, sorry about that, which one is the cloud Kijunsen or Senkouspana

 
Tiberious:

Thanks, sorry about that, which one is the cloud Kijunsen or Senkouspana

You want to use the cloud, yet you don't know what the cloud is??

It is made up of 2 buffers, senkouspan A and B.

 
Keith Watford:

You want to use the cloud, yet you don't know what the cloud is??

It is made up of 2 buffers, senkouspan A and B.

Just practicing getting to know stuff i dont know yet Thanks 

 
Tiberious:

Just practicing getting to know stuff i dont know yet Thanks 

Looking back what would I use instead of PRICE_CLOSE?

 
Tiberious: Looking back what would I use instead of PRICE_CLOSE?

It depends on your strategy logic. Did you mean to use the previous candle's close price "Close[1]" or did you want to use the current market price (Bid or Ask)?

Since, all chart and indicator data is based on Bid prices, you most probably will want to use the Bid price for comparisons with chart or indicator data.

However, please note that there is spread to consider. Buy orders open at Ask and close (SL & TP) at Bid price. Sell orders open at Bid and close (SL & TP) at Ask price.

See the documentation on predefined variables - https://docs.mql4.com/predefined

Predefined Variables - MQL4 Reference
Predefined Variables - MQL4 Reference
  • docs.mql4.com
Predefined Variables - MQL4 Reference
 
Fernando Carreiro:

It depends on your strategy logic. Did you mean to use the previous candle's close price "Close[1]" or did you want to use the current market price (Bid or Ask)?

Since, all chart and indicator data is based on Bid prices, you most probably will want to use the Bid price for comparisons with chart or indicator data.

However, please note that there is spread to consider. Buy orders open at Ask and close (SL & TP) at Bid price. Sell orders open at Bid and close (SL & TP) at Ask price.

See the documentation on predefined variables - https://docs.mql4.com/predefined

Great thanks!

Reason: