Download MetaTrader 5

last deal profit/loss

To add comments, please log in or register
AndreaG
37
AndreaG  

hi,

 

I'm writing a neural network and need it to know if the last operation was successful.

something like 

  if [last deal generate profit] then x=0

if [last deal was at loss] then x=1

and possibly

  if [last 2 deals was at loss] then x=-1

what is the parameter can I use to find out the info I need?

 

thank you (and sorry for my english ;-) )

:-) 

Marco vd Heijden
Moderator
4804
Marco vd Heijden  
AndreaG:

hi,

 

I'm writing a neural network and need it to know if the last operation was successful.

something like 

  if [last deal generate profit] then x=0

if [last deal was at loss] then x=1

and possibly

  if [last 2 deals was at loss] then x=-1

what is the parameter can I use to find out the info I need?

 

thank you (and sorry for my english ;-) )

:-) 

MODE_HISTORY
Doerk Hilger
1190
Doerk Hilger  

First you need to define what a "deal" is. A deal it not a position, a trade is not a position as well.

A trade starts with the opening of a position and it ends when the last position was closed. All positions in between are part of the trade/deal. I have no idea what you want to code, but sou should keep this in mind if you want to achieve good results. MODE_HISTORY ... i tried to work with that too, but I could not figure out which history data it´s actually providing and how long history data is saved. 

Alain Verleyen
Moderator
31478
Alain Verleyen  
AndreaG:

hi,

 

I'm writing a neural network and need it to know if the last operation was successful.

something like 

  if [last deal generate profit] then x=0

if [last deal was at loss] then x=1

and possibly

  if [last 2 deals was at loss] then x=-1

what is the parameter can I use to find out the info I need?

 

thank you (and sorry for my english ;-) )

:-) 

Your question is about mql4 or mql5 ?
AndreaG
37
AndreaG  

Mql5, sorry, I forget that detail :-)

 

I need to know si the answer to the question: "in the last trade I gain money or I lose money?"

it would be good io I can find the answer to that question even for the trade before that

Xiangdong Guo
3834
Xiangdong Guo  

Check HistoryDealGetInteger in MQL5 Reference, it provides some example codes.

To add comments, please log in or register