last deal profit/loss

 

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 ;-) )

:-) 

 
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
 

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. 

 
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 ?
 

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

 

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

Reason: