Problem with entryprice  [SOLVED]

Questions about MultiCharts and user contributed studies.
Pierluis
Posts: 5
Joined: 30 Jun 2016
Has thanked: 4 times

Problem with entryprice

Postby Pierluis » 05 Jul 2016

Hi everybody!

I would need some help because I can get fix a trouble I have with "entryprice".

My problem is very simple: I have a signal who opens a position in the morning and close it at the end of the day with setexitonclose and I just would like to plot the value of the open trade (the entryprice) on the graph but if I call "entryprice" or "entryprice(0)" it returns 0.

Instead I have tried to call "entryprice(1)" and in fact it returns the value of the opening trade of the day before!

So I am getting crazy because I do not understand why I can't have the entryprice of the trade of the current day!

Is there anybody who can help me please?

Thanks and ciao (from Italy) :-)

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Problem with entryprice

Postby TJ » 05 Jul 2016

entryprice is calculated at EOB (End of Bar).

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Problem with entryprice

Postby TJ » 05 Jul 2016

just in case you are not aware:
See post #6
[FAQ] SetExitOnClose
viewtopic.php?f=16&t=10811

Pierluis
Posts: 5
Joined: 30 Jun 2016
Has thanked: 4 times

Re: Problem with entryprice

Postby Pierluis » 06 Jul 2016

Thank you very much TJ in particular for the suggestion about setexitonclose.

I still have the problem with "entryprice" when if it is calculated at EOB: I attached the rows of the codes and the results that I get from using entry price(1) and entryprice(0) in my graph (Dax, 15 minutes timeframe).

I would expect that at the 4th bar of today it should display the entry price of the current open trade, instead using "entryprice" it returns 0 while using entryprice(1) it returns the value of the previous entry... what am I doing wrong?

Many thanks!
Attachments
entryprice.gif
(72.54 KiB) Downloaded 694 times

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Problem with entryprice

Postby TJ » 06 Jul 2016

Thank you very much TJ in particular for the suggestion about setexitonclose.

I still have the problem with "entryprice" when if it is calculated at EOB: I attached the rows of the codes and the results that I get from using entry price(1) and entryprice(0) in my graph (Dax, 15 minutes timeframe).

I would expect that at the 4th bar of today it should display the entry price of the current open trade, instead using "entryprice" it returns 0 while using entryprice(1) it returns the value of the previous entry... what am I doing wrong?

Many thanks!
What is EP?

Pierluis
Posts: 5
Joined: 30 Jun 2016
Has thanked: 4 times

Re: Problem with entryprice

Postby Pierluis » 06 Jul 2016

EP is a variable to which I try to assign the value of the entryprice (it is declared at the beginning in "Vars: EP(0),...").

I have also already tried to plot directly the "entryprice" without using EP, but it does not work anyway as you can see in the new attached screenshot.

Thank you really very much for your help!
Attachments
entryprice1.gif
(44.14 KiB) Downloaded 692 times

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Problem with entryprice

Postby TJ » 06 Jul 2016

EP is a variable to which I try to assign the value of the entryprice (it is declared at the beginning in "Vars: EP(0),...").

I have also already tried to plot directly the "entryprice" without using EP, but it does not work anyway as you can see in the new attached screenshot.

Thank you really very much for your help!

Image
Attachments
ID.jpg
(29.87 KiB) Downloaded 740 times

Pierluis
Posts: 5
Joined: 30 Jun 2016
Has thanked: 4 times

Re: Problem with entryprice  [SOLVED]

Postby Pierluis » 06 Jul 2016

Hi TJ, I have fixed my problem: the solution was to bring the instruction "Text" out of the "if...end" condition.

EP is working good, it is just a personal variable that I use to store the entryprice for other purposes but I also need to plot on the chart.

Everything is perfect now, thank you very much for your interest and collaboration :-)


Return to “MultiCharts”