entryprice

Questions about MultiCharts and user contributed studies.
auato
Posts: 89
Joined: 23 Nov 2016
Has thanked: 18 times

entryprice

Postby auato » 18 May 2017

Hi everybody,

today happened something weird in my opinion. A script of mine (IOG enabled) uses entryprice reserved word to calculate profit target, StopLoss and TrailingStop.
I did these calculations in IOG since I realized that my broker API doesn't understand or doesn't transmit correctly the appropriate PowerLanguage commands like setstoploss or setprofittarget or setpercenttrailing. Of course in backtest phase everything runs perfectly but this morning my signal has had for the first time a real test bech. Fortunately I activated the print() statement to follow all variables in my script during the "live" execution. So the entry has been made successfully as expected in the chart but after this I noticed in the PLE output that entryprice() proceeded with a value 0 instead of the real entry price... so I spent the whole day to follow by myself the market fluctuations and then I decided to exit manually. After the "live" session, I ran again the script and... surprice!!! :o ... offline it returned to run correctly, the entry value was the same for the real trade and with entryprice() correctly valorized. To address correctly the issue I experienced, I would like to understand why entryprice didn't valorized correctly (even though my strategy sent correctly the the signal and it was correctly and promptly filled) and if it depends from MC or something happend in the communication with my broker.
As I read contrasted opinions in this forum I repeat the question: in Autotrading mode (SA or AA) does entryprice only return the entry price calculated by the strategy on the chart or it is the real and filled price from the broker? :?:
Do you have some experience in using the entryprice in your signal and do you know its limits?

Thank you,
auato

User avatar
Angelina MultiСharts
Posts: 260
Joined: 28 Dec 2016
Has thanked: 28 times
Been thanked: 66 times

Re: entryprice

Postby Angelina MultiСharts » 24 May 2017

Hello auato,

It depends on the broker connection. In this particular situation:
Which broker do you use?
Which mode was selected - AA or SA?
What was the chart position?

auato
Posts: 89
Joined: 23 Nov 2016
Has thanked: 18 times

Re: entryprice

Postby auato » 24 May 2017

Hi Angelina,
I used Webank in SA mode and the chart was flat

Thank you
Auato

auato
Posts: 89
Joined: 23 Nov 2016
Has thanked: 18 times

Re: entryprice

Postby auato » 30 May 2017

Reflecting on what happened for entryprice() function, I am also wondering if there is a way to pass externally a value into a variable while the script is running in the chart. For example, last time happend to me that my computer crashed and, of course, when I resumed the chart, all variables were lost.

User avatar
Angelina MultiСharts
Posts: 260
Joined: 28 Dec 2016
Has thanked: 28 times
Been thanked: 66 times

Re: entryprice

Postby Angelina MultiСharts » 31 May 2017

auato,

If this issue is reproduced again, please come to our Live Chat before 1 pm EST so we could investigate it via remote connection.
We haven't been able to reproduce this behavior.

In AA mode entryprice is the chart price, it might be different from "filled" price on Order and Position Tracker. In SA mode entryprice = filled price from the broker.
PowerLanguage commands like setstoploss or setprofittarget or setpercenttrailing use the real entry price from the broker no matter which auto trading mode is selected.

auato
Posts: 89
Joined: 23 Nov 2016
Has thanked: 18 times

Re: entryprice

Postby auato » 31 May 2017

Thank you Angelina.
OK, I'll let you know

BR,
auato

auato
Posts: 89
Joined: 23 Nov 2016
Has thanked: 18 times

Re: entryprice

Postby auato » 06 Jun 2017

I come back to the topic because today I have experienced another weird behavior. I am briefly going to depict what happend and I ask two questions.

-Yesterday my strategy (it can be a multiday strategy) entered in short position but there were not right conditions to exit intraday;
-so yesterday, at the end of the session, I left the chart open (and in SA mode) to prevent the losing of its variables (no touched anything for all the night);
- as my broker disconnects the connection automatically every night, this morning before the new market session started, I only restarted the API (but not the graph), and enabled again SA mode;
- a few minutes later, at the opening of the new session, entryprice() changed the value (from the correct value 20855 into 20720) and marketposition changed from -1 to 0 and currentcontracts from 1 to 0;

questions:
1) Can you suggest me a solution to store these variables (I mean entryprice and marketposition for example) permanently so I can close the chart and computer after the end of the session and re-open it next morning to continue the pending trade?

2) Is there a way to manually pass the variables (i.e. via commandline)? I would like to have this feature and I would like to propose it to develop for the next releases if possible.

User avatar
Angelina MultiСharts
Posts: 260
Joined: 28 Dec 2016
Has thanked: 28 times
Been thanked: 66 times

Re: entryprice

Postby Angelina MultiСharts » 06 Jun 2017

auato,

Are you using "Assign the initial Market position at Broker: use actual position at the broker"?

auato
Posts: 89
Joined: 23 Nov 2016
Has thanked: 18 times

Re: entryprice

Postby auato » 06 Jun 2017

Hi Angelina,
honestly I am not sure if I used "Assign the initial Market position at Broker: Assume the initial market position at the broker the SAME AS on the CHART" or as you wrote "use the actual position at the broker"

User avatar
Angelina MultiСharts
Posts: 260
Joined: 28 Dec 2016
Has thanked: 28 times
Been thanked: 66 times

Re: entryprice

Postby Angelina MultiСharts » 06 Jun 2017

auato,

"Use the actual position on broker" allows you to get both broker position and entryprice each time you start Auto trading.

auato
Posts: 89
Joined: 23 Nov 2016
Has thanked: 18 times

Re: entryprice

Postby auato » 06 Jun 2017

What does it mean? Is it randomic? Can you make an example?


Return to “MultiCharts”