Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 178

 
pu6ka:
It looks the same to me. Arrows can be drawn as part of the indicator buffer, and objects are created via ObjectCreate()


I'm not going to argue.
 
tara:

I don't know what the comrades will say, but it looks fine to me. It draws arrows, but no objects.

I realise that I asked a silly question, then how does the indicator draw arrows through the buffers, and how do I interpret them into trading signals?
 

bistreevseh:

I realise I asked a silly question, then how does the indicator draw the arrows through the buffers and how do I interpret them into trading signals?
most likely when there is no signal the indicator buffer value is EMPTY_VALUE

how to catch a signal - here are ideas and implementation


 
bool Stochastic () {
double Sig_Buy = zoneBUY; 
double Sig_Sell = zoneSELL;
bool Exit_UrBuy = TRUE;
bool Exit_UrSell = TRUE;
double sM0,sM1,sS0, sS1;
bool Bar_BuyCross = FALSE;
bool Bar_SellCross = FALSE;
int bar_b, bar_s;


   sM0  = iStochastic(NULL,timeframe,KPeriod,DPeriod,Slowing,MODE_SMA,0,MODE_MAIN,1);
   sM1  = iStochastic(NULL,timeframe,KPeriod,DPeriod,Slowing,MODE_SMA,0,MODE_MAIN,2);
   sS0 = iStochastic(NULL,timeframe,KPeriod,DPeriod,Slowing,MODE_SMA,0,MODE_SIGNAL,1);
   sS0 = iStochastic(NULL,timeframe,KPeriod,DPeriod,Slowing,MODE_SMA,0,MODE_SIGNAL,2);


bool CrossBuy = (sS0<Sig_Buy && sM0<Sig_Buy && sM1<sS1 && sM0>=sS0);
bool CrossSell = (sS0>Sig_Sell && sM0>Sig_Sell && sM1>sS1 && sM0<=sS0);

if (UseExitUr) {
if (sM0 >Sig_Buy && sM1 <= Sig_Buy) Exit_UrBuy = TRUE;
else Exit_UrBuy = FALSE;
if (sM0 <Sig_Sell && sM1 >= Sig_Sell) Exit_UrSell = TRUE;
else Exit_UrSell = FALSE;
}

if (CrossBuy) { TimeCrossB =  iOpen( NULL, 0, 1); }

  for (int cnt = 1 ; cnt < Finder ; cnt++) {
bar_b = iBarShift(NULL, 0, TimeCrossB, cnt); 
if (bar_b > 0) Bar_BuyCross = TRUE; 
}

if (Bar_BuyCross && Exit_UrBuy) {
     Li_24 = TRUE;
     TimeCrossB = -1;
 }

if (CrossSell) {TimeCrossS = iOpen( NULL, 0, 1);}

for (int cnm = 1 ; cnm < Finder ; cnm++) {
bar_s = iBarShift(NULL, 0, TimeCrossS, cnm); 
if (bar_s > 0) Bar_SellCross = TRUE; 
}


if (Bar_SellCross && Exit_UrSell) {
    TimeCrossS = -1;
    Li_28 = TRUE;
   }

   return(false);
}

Dear Professionals, please help me with this idea. I want to catch a signal from the stochastic when it leaves the overbought (oversold) zone, if its lines cross these zones. I also want this crossing to be not further than a certain number of bars - the Finder parameter. But I cannot implement it. If you have some fresh eyes, please, look where there are errors.

Note: Parameters:

Li_28 = TRUE; и Li_24 = TRUE; 

owl reads as good to open orders

 
dr.Vasgenich:

Look at the code with fresh eyes and see where the errors are.

Sorry I'm not a pro, but code of this size without a single comment

1) prolongs the time needed for parsing and searching for the error;

2) discourages you from parsing and searching for the error.

 

Friends, I understand that for many this will be trivial and simple, but could you help me write an EA in which will appear audible signal when the MAKD histogram will cross the "0" on H4 and D1. That's it.

Maybe I already had such questions, sorry in that case. But I need the code very much ...

 
CAYANNE:

Friends, I understand that for many this will be trivial and simple, but could you help me write an EA in which will appear audible signal when the MAKD histogram will cross the "0" on H4 and D1. That's it.

Maybe I already had such questions, sorry in that case. But I need the code very much ...


It's this way.
 

Can you tell me how to implement a ban on installing a second indicator of the same type in a window, if one is already installed there?

I would like to do it directly in the indicator code, but I don't know how to do it.

The only thing I can think of is checking of the indicator in init(), but init() is called after the indicator is installed...

 

Please help!

 OrderClose( OrderTicket(), 0.1, NormalizeDouble(Bid,2), 1 );  
      Alert("Маємо помилку ",GetLastError());

Error 0 and the order does not close! What is wrong?

 
Izdesbyll:

Please help!

Error 0 and the order does not close! What is wrong?

And why are you normalising the price to two? To Digits is necessary. It is easier to write OrderClosePrice() instead of Bid
Reason: