somebody Help me!!

 

Hi.

I have my EA and I want that my Stop Loss and Take Profit be the calculation of some  variables of my  Indicator (Pivot).


How i can to do it?

Tha calculation is from my EA or I can to add the variables Resistence and Support from my Indicator?

In my EA the structure MQL5 to put order with stop loss and take profit is in this moment:

mrequest.sl = NormalizeDouble(latest_price.ask - STP*_Point,_Digits); //Stop Loss

mrequest.tp = NormalizeDouble(latest_price.ask + TKP*_Point,_Digits); // take Profit


But, I said above, I want that is mrequest  be my RS1 ans SP1. If I need to do a calculate from my EA or to come some variable or to brig the variables to my EA, how will be the mrequest?

Thanks , if sombody help me, I will be pleasure so much and if need more information, don´t hesitate contact with me soon.

Thanks for you advanced help!

Marcos (Santiago/Chile)

marcos.tebrich@sybcm.net

 

¡Hola, Marcos!

If your Pivot indicator has two buffers, one of which contains resistance and other - support, then all you have to do is to use it as a custom indicator in our EA (with iCustom() function).

For example, your indicator is called "Pivots". In your OnInit() event handler, you should add something like this:

Piv_handle=iCustom(NULL,0,"Pivots", ... parameteres if you need them ...);

Then in your main EA function you can copy both buffers (with resistance and support) out of your custom indicator:

double Supp[], Res[];

int copy = CopyBuffer(Piv_handle, 0, 0, 1, Res);
if (copy <= 0) Print("Error copying Resistance buffer");
copy = CopyBuffer(Piv_handle, 1, 0, 1, Supp);
if (copy <= 0) Print("Error copying Support buffer");

Now you can start using your support/resistance. For example, print out:

Print("Resistance: ", Supp[0]);
Print("Support: ", Supp[0]);

Or set for stop-loss and take-profit:

mrequest.sl = NormalizeDouble(Supp[0]); //Stop Loss

mrequest.tp = NormalizeDouble(Res[0]); // take Profit
Step on New Rails: Custom Indicators in MQL5
  • 2009.11.23
  • Андрей
  • www.mql5.com
I will not list all of the new possibilities and features of the new terminal and language. They are numerous, and some novelties are worth the discussion in a separate article. Also there is no code here, written with object-oriented programming, it is a too serous topic to be simply mentioned in a context as additional advantages for developers. In this article we will consider the indicators, their structure, drawing, types and their programming details, as compared to MQL4. I hope that this article will be useful both for beginners and experienced developers, maybe some of them will find something new.
 
enivid:

¡Hola, Marcos!

If your Pivot indicator has two buffers, one of which contains resistance and other - support, then all you have to do is to use it as a custom indicator in our EA (with iCustom() function).

For example, your indicator is called "Pivots". In your OnInit() event handler, you should add something like this:

Then in your main EA function you can copy both buffers (with resistance and support) out of your custom indicator:

Now you can start using your support/resistance. For example, print out:

Or set for stop-loss and take-profit:

Hola Amigo. (Hi Friend)

I´m grateful so much for you help, Thanks.

Will be dong it

Please, don´t hesitate if you need anything from here

 

Marcos 

 
enivid:

¡Hola, Marcos!

If your Pivot indicator has two buffers, one of which contains resistance and other - support, then all you have to do is to use it as a custom indicator in our EA (with iCustom() function).

For example, your indicator is called "Pivots". In your OnInit() event handler, you should add something like this:

Then in your main EA function you can copy both buffers (with resistance and support) out of your custom indicator:

Now you can start using your support/resistance. For example, print out:

Or set for stop-loss and take-profit:

I again.

enivid, I did all you put me, but when I compile send em as following message:

Piv_handle - undeclared identifier

 

I tried to declared Piv_handle, but same send me error!! Where is the problem?

 

Thanks again

 

Marcos 

 
tebrich1:

I again.

enivid, I did all you put me, but when I compile send em as following message:

Piv_handle - undeclared identifier

 

I tried to declared Piv_handle, but same send me error!! Where is the problem?

 

Thanks again

 

Marcos 

You should declare it as int (global variable).
 

enivid:
You should declare it as int (global variable).

Thanks  enivid for you help again.

The last question:

I have declared and it working , but in my Journal when I´m running Testing of my EA the Stop Loss and Take Profit have the same  number

EXAMPLE

 2010.07.20 09:51:01 Core 1 Soporte : 1.23387
 2010.07.20 09:51:01 Core 1 Resistencia : 1.23387

 

Thanks for you advance help

 

Marcos 

 
tebrich1:
Thanks  enivid for you help again.

The last question:

I have declared and it working , but in my Journal when I´m running Testing of my EA the Stop Loss and Take Profit have the same  number

EXAMPLE

 2010.07.20 09:51:01 Core 1 Soporte : 1.23387
 2010.07.20 09:51:01 Core 1 Resistencia : 1.23387

 

Thanks for you advance help

 

Marcos 

Does your indicator have two separate buffers for Supp and Res?

Do you call CopyBuffer() with 0 and 1 for buffer number for Supp and Res?

Documentation on MQL5: Timeseries and Indicators Access / CopyBuffer
  • www.mql5.com
Timeseries and Indicators Access / CopyBuffer - Documentation on MQL5
 
enivid:

Does your indicator have two separate buffers for Supp and Res?

Do you call CopyBuffer() with 0 and 1 for buffer number for Supp and Res?

Hi enivid, sorry if I have inconvenienced you, but I greatful for it so much.

Yes, I have had problem with the buffer number, now, I changed it and working my strategy tester and resistence and Support are different, i will see is I do all Ok.


Thanks again for you help