Indicator Help :(

 
Hi,

I am not the best at mql4 programming but I have a question.

I am using an indicator called N_StepMA_1 - attached

Now i have an EA that opens trades when the yellow line crosses the teal line of the indicator. I have that all working fine.

The problem is, afterthis happens and the next bar comes, you get a beep and then either a blue arrow or red arrow confirming this. When my EA trades, sometimes during a bar the lines can cross, but the bar closes without a signal (an arrow) to confirm it, which gives me a lot of false signals and I end up entering in the wrong direction.

I don't know the code to make sure there is a blue or red arrow to enter the trade. Is there a way I can trade on the arrow signals rather than the crossing of the lines?

Any help would be greatly appreciated

Regards

pete
Files:
 

I'm not looking at the code but there are two choices for the arrows:

1. They are objects, detect the object (this is less likely)

2. They are drawn by two indicator indexes, and you have to discover a price value in the appropriate index that causes the arrow to be drawn at that price (the index value) on the chart.

Having detected the arrow you can then proceed with your trade opening logic.

Your EA apparently already has detection of the line indexes -- iCustom(), add (or replace) logic to detect the arrows.

 
Does anyone know how to convert this indicator to EA?
 

Thanks for your reply,


They are definitely not objects. The problem is the price (index value) is between 0 and 1 i believe.


But these two lines can move up and down between them. They are not fixed constants such as Stochastic Indicator.

Where Sell on 80 buy on 20 etc.


They move with the trend, so I dont think this will work.


Maybe I am wrong, just need a bit more help just to make sure there is a confirmation arrow before order open.


thanks

 

hey pete.... your not understanding what phy is saying..... he is correct......

//----

your ea must be trading on the 0 bar, an unfinshed bar.... move the trade entrys to the first closed bar after a cross..... the arrows are placed on a confirmed cross only....

to time your trades properly you can use buffer 2, Blue Buy arrow and buffer 3, Red Sell arrow ...... or you can use the common cross technique... the crossing of buffer 0 and buffer 1.....

the code below is just a quick example..... in reality it would be more accurate to have a properly written function return buy/sell signals......h

i

int start()
  {
//----
   //SetIndexBuffer(0,LineMinBuffer);  -> Yellow line
   //SetIndexBuffer(1,LineMidBuffer);  -> Teal line
   //SetIndexBuffer(2,LineBuyBuffer);  -> Buy arrow
   //SetIndexBuffer(3,LineSellBuffer); -> Sell arrow

  if(OrdersTotal() <  10)
  {
  //if(iCustom(NULL,0,"Nina",2,1) == iCustom(NULL,0,"Nina",1,1))
  if(iCustom(NULL,0,"Nina",0,1) > iCustom(NULL,0,"Nina",1,1) && iCustom(NULL,0,"Nina",0,2) < iCustom(NULL,0,"Nina",1,2))
  {
  OrderSend(Symbol(),OP_BUY, Lots,Ask,3,Ask-Stoploss*Point,Ask+ProfitTarget*Point,"buy",MagicNumber,0,Blue);
  }
  //if(iCustom(NULL,0,"Nina",3,1) == iCustom(NULL,0,"Nina",1,1))
  if(iCustom(NULL,0,"Nina",0,1) < iCustom(NULL,0,"Nina",1,1) && iCustom(NULL,0,"Nina",0,2) > iCustom(NULL,0,"Nina",1,2))
  {
  OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+Stoploss*Point,Bid-ProfitTarget*Point,"sell",MagicNumber,0,Red);
  }
  } 

//----

//---

//----

//---

//---

 

Wow hayseed.


Thanks so much for your help, this works now.

I had no idea that you could use the buffers, like I said i only just started getting into mql4 programming.


have a merry christmas


pete

Reason: