Marina,
I try to change a strategy to a pyramiding strategy but I can't get the right EntryPrices for positions greater than the first position. It looks like that the reserved words could not handle pyramiding? They don't change after the first position. Can you help me with this?
Thanks,
Rob.
Sample code:
If CurrentPosition >= 0 then begin
Sell Short ("Short Entry#1") This Bar 1 contracts on Close;
CurrentPosition = -1;
end
else
If CurrentPosition = -1 AND MaxPosSize > 1 AND (EntryPrice(0) - Close) * VarBigPointValue >= PyramidingProfit then begin
Sell Short ("Short Entry#2") This Bar 1 contracts on Close;
CurrentPosition = -2;
end
else
If CurrentPosition = -2 AND MaxPosSize > 2 AND (EntryPrice(0) - Close) * VarBigPointValue >= PyramidingProfit then begin
Sell Short ("Short Entry#3") This Bar 1 contracts on Close;
CurrentPosition = -3;
end
else
If CurrentPosition = -3 AND MaxPosSize > 3 AND (EntryPrice(0) - Close) * VarBigPointValue >= PyramidingProfit then begin
Sell Short ("Short Entry#4") This Bar 1 contracts on Close;
CurrentPosition = -4;
end
else
If CurrentPosition = -4 AND MaxPosSize > 4 AND (EntryPrice(0) - Close) * VarBigPointValue >= PyramidingProfit then begin
Sell Short ("Short Entry#5") This Bar 1 contracts on Close;
CurrentPosition = -5;
end;
print (time, " EP(0): ", EntryPrice(0), " EP(1): ", EntryPrice(1), " EP(2): ", EntryPrice(2), " EP(3): ", EntryPrice(3), " EP(4): ", EntryPrice(4));
EntryPrice(x) reserved word does not change when pyramiding
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
Marina,
Thanks for your quick answer. Because it's a urgent problem for me I called also the phone helpdek (spoke to Surgey?) who asked me to send my problem via help@tssupport.com. Because I've already contact with you now, I will not send it again via email.
The code I provided was only part of my strategy: I thought/hoped that the problem was known to you so I didn't make the code ready to compile. Now you're asking, I made it specific. It doesn't matter on which chart you run it, the reserved words does not change after the first position.
Thanks in advance,
Rob.
P.S. The quality of the phone line was very bad; It was very hard to understand Surgey. Do you use VOIP? I remarked a big latency.
If BarNumber = 1 then begin
Sell Short ("Short Entry#1") This Bar 1 contracts on Close;
end;
If BarNumber = 2 then begin
Sell Short ("Short Entry#2") This Bar 1 contracts on Close;
end;
If BarNumber = 3 then begin
Sell Short ("Short Entry#3") This Bar 1 contracts on Close;
end;
If BarNumber = 4 then begin
Sell Short ("Short Entry#4") This Bar 1 contracts on Close;
end;
If BarNumber = 5 then begin
Sell Short ("Short Entry#5") This Bar 1 contracts on Close;
end;
if BarNumber < 6 then print (time, " EP(0): ", EntryPrice(0), " EP(1): ", EntryPrice(1), " EP(2): ", EntryPrice(2), " EP(3): ", EntryPrice(3), " EP(4): ", EntryPrice(4));
Thanks for your quick answer. Because it's a urgent problem for me I called also the phone helpdek (spoke to Surgey?) who asked me to send my problem via help@tssupport.com. Because I've already contact with you now, I will not send it again via email.
The code I provided was only part of my strategy: I thought/hoped that the problem was known to you so I didn't make the code ready to compile. Now you're asking, I made it specific. It doesn't matter on which chart you run it, the reserved words does not change after the first position.
Thanks in advance,
Rob.
P.S. The quality of the phone line was very bad; It was very hard to understand Surgey. Do you use VOIP? I remarked a big latency.
If BarNumber = 1 then begin
Sell Short ("Short Entry#1") This Bar 1 contracts on Close;
end;
If BarNumber = 2 then begin
Sell Short ("Short Entry#2") This Bar 1 contracts on Close;
end;
If BarNumber = 3 then begin
Sell Short ("Short Entry#3") This Bar 1 contracts on Close;
end;
If BarNumber = 4 then begin
Sell Short ("Short Entry#4") This Bar 1 contracts on Close;
end;
If BarNumber = 5 then begin
Sell Short ("Short Entry#5") This Bar 1 contracts on Close;
end;
if BarNumber < 6 then print (time, " EP(0): ", EntryPrice(0), " EP(1): ", EntryPrice(1), " EP(2): ", EntryPrice(2), " EP(3): ", EntryPrice(3), " EP(4): ", EntryPrice(4));
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
Hi Rob,
The reserved words won't change their value until the script has been calculated. The order's price is not known until it's generated. And all orders are submitted after all the scripts have been calculated.
If you compare the script's behaviour in TS you can see that it's identical to that of MultiCharts.
If you need a more detailed explanation please let me know.
Regards.
The reserved words won't change their value until the script has been calculated. The order's price is not known until it's generated. And all orders are submitted after all the scripts have been calculated.
If you compare the script's behaviour in TS you can see that it's identical to that of MultiCharts.
If you need a more detailed explanation please let me know.
Regards.
Marina,
I don't understand your answer completely.
This script is called every bar, during the first bar only 1 position is taken, the second bar (when the script for the first bar is finished) the second position is taken and so on. I thought that the code/script is calculated for every bar?
Regards,
Rob.
I don't understand your answer completely.
This script is called every bar, during the first bar only 1 position is taken, the second bar (when the script for the first bar is finished) the second position is taken and so on. I thought that the code/script is calculated for every bar?
Regards,
Rob.
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
Hi Rob,
The description below of how the position works might help to understand the issue above:
A trading position starts with the first entry order (Buy, SellShort) and ends where MarketPosition changes (after the complete exit, or reversal into the opposite position).
EntryPrice returns the entry price for the specified position.
EntryPrice assumes the parameter position_ago. In other words, which position's EntryPrice is of importance for us (0 is the current position. 1 the previous one etc). EntryPrice without parameters returns EntryPrice of the current position (same as EntryPrice(0)). EntryPrice returns the price of the very first entrance into the position.
In the example above, the current position has been opened but it hasn't been closed yet (or reversed).
Hope the above helps. If you need further explanation please let me know.
Best regards.
The description below of how the position works might help to understand the issue above:
A trading position starts with the first entry order (Buy, SellShort) and ends where MarketPosition changes (after the complete exit, or reversal into the opposite position).
EntryPrice returns the entry price for the specified position.
EntryPrice assumes the parameter position_ago. In other words, which position's EntryPrice is of importance for us (0 is the current position. 1 the previous one etc). EntryPrice without parameters returns EntryPrice of the current position (same as EntryPrice(0)). EntryPrice returns the price of the very first entrance into the position.
In the example above, the current position has been opened but it hasn't been closed yet (or reversed).
Hope the above helps. If you need further explanation please let me know.
Best regards.
Marina,
Thanks for your explanation. You are faster than the response I would give you on basis of my research:
I ran the same code with TS2000i and got, like you said, the same results. That's when some bells rang; my understanding of a position/entry was wrong. I thought that a position/entry was the same as an order, so several orders where as much as positions (entries). Now I know...
Thanks again for your fast and clear explanation and your patience with learning customers...
Regards,
Rob.
Thanks for your explanation. You are faster than the response I would give you on basis of my research:
I ran the same code with TS2000i and got, like you said, the same results. That's when some bells rang; my understanding of a position/entry was wrong. I thought that a position/entry was the same as an order, so several orders where as much as positions (entries). Now I know...
Thanks again for your fast and clear explanation and your patience with learning customers...
Regards,
Rob.
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
- ABC
- Posts: 718
- Joined: 16 Dec 2006
- Location: www.abctradinggroup.com
- Has thanked: 125 times
- Been thanked: 408 times
- Contact:
Rob,
take a look at the reserved word "avgentryprice", this will give you the average entry price of each open entry in a pyramided position.
For every single added contract you can store the entryprice in a variable for example, if the average entry price is not what you are looking for.
Best regards,
ABC
take a look at the reserved word "avgentryprice", this will give you the average entry price of each open entry in a pyramided position.
For every single added contract you can store the entryprice in a variable for example, if the average entry price is not what you are looking for.
Best regards,
ABC
- ABC
- Posts: 718
- Joined: 16 Dec 2006
- Location: www.abctradinggroup.com
- Has thanked: 125 times
- Been thanked: 408 times
- Contact:
Blue:supporte, Red: Not Supported, and Gray:???
What are gray colors?
I found the answer myself: those are typos in the list and they should be
totalbarseventrades
totalbarslostrades
totalbarswintrades
but , not
totalbarsevemtrade
totalbarslostrade
totalbarswintrade
<P.S>
Marina, please correct typos and also update the list.
I found the answer myself: those are typos in the list and they should be
totalbarseventrades
totalbarslostrades
totalbarswintrades
but , not
totalbarsevemtrade
totalbarslostrade
totalbarswintrade
<P.S>
Marina, please correct typos and also update the list.
Does ClearDebug work correctly?
ClearDebug is supposed to clear the Output window, but it does not at all.
Please check this.
Please check this.
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007