|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 3/18/2010 1:10:20 PM
Posts: 75,
Visits: 110
|
|
The Envelopes is similar to the Moving Average indicator. In consists of two Moving Averages, one displaced up, and one displaced down.It shows the range of the expected price behavior, so if price goes out of the area between two lines, it will come back to it.
My Envelopes Strategy opens a long position if the price goes above the bottom line. The strategy opens a sell position if th3 price goes below the top indicator line.
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 3/18/2010 1:10:20 PM
Posts: 75,
Visits: 110
|
|
Here is the script
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 11/12/2009 8:36:31 AM
Posts: 8,
Visits: 10
|
|
| Interesting... Looks like it works. How did you manage to write this? Did you read the manual?
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 9/30/2010 6:57:38 AM
Posts: 21,
Visits: 20
|
|
I have tried to launch your script in the Tester. Looks like it really works 
However, your strategy tells me the open rate of every position, but somehow it does not tell the close rate
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 3/18/2010 1:10:20 PM
Posts: 75,
Visits: 110
|
|
Sniper, I did not read all the manual through I just looked at the examples. They are not as difficult as they seem to be.
Stone, what do you mean? Do you mean that there are no messages in the log about the close rate, or anything else?
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: 10/6/2010 8:50:07 AM
Posts: 46,
Visits: 84
|
|
Well done, Elvin!!
I have not written anything in the Strategy Editor yet. I have to try. Looks like it's even simpler than creating indicators. Perhaps I'm mistaken though.
br,
Phil Richter
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 9/30/2010 6:57:38 AM
Posts: 21,
Visits: 20
|
|
Here in the picture you can see that Open Rate is shown, but clsoe rate isn't there.
|
|
|
|
|
Forum Guru
      
Group: Forum Members
Last Login: 10/4/2010 6:19:12 AM
Posts: 67,
Visits: 186
|
|
Look through the script, Stone.
Take note of these lines:
procedure OnTradeChange(const Action: TDataModificationType; const Trade: TTrade);
begin
if (Action=dmtInsert) then if (Trade.Tag='SellEnv') then log ('Sell trade opened.');
if (Action=dmtInsert) then if (Trade.Tag='BuyEnv') then log ('Buy trade opened.');
if (Action=dmtInsert) then log ('Open Rate.' +FloatToStr(Trade.OpenRate));
end;
As you can see, Elvin has determined here which messages should be output in the log. I guess, to see the close Rate, you need the line:
if (Action=dmtInsert) then log ('Close Rate.' +FloatToStr(Trade.CloseRate));
Sincerely,
Benjamin Hoover
|
|
|
|
|
Administrator
Group: Administrators
Last Login: 2/7/2012 9:02:20 AM
Posts: 245,
Visits: 1,220
|
|
Scriptor is absolutely right.
However, please consider that in this case the Close rate output in the log is the Close rate at the moment when the position is opened, and not at the time when it is closed.
Best regards
-ACTFX© Forum Administrator
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 9/30/2010 6:57:38 AM
Posts: 21,
Visits: 20
|
|
Thank you very much, scriptor!
Sorry, I am not a professsional programmer.
|
|
|
|