Page 3 of 9

Re: FX Strategy Wizard Beta

PostPosted: Thu Oct 17, 2013 7:16 am
by kevinleijh
Hi what if i want to use variable values of a custom indicator as trigger for buy or sell how do i code it in the expression. For example variable "label" of custom indicator is 1 it is a sell signal how do I code it on the expression thanks

Re: FX Strategy Wizard Beta

PostPosted: Fri Oct 25, 2013 12:41 am
by Valeria
Hi kevinleijh,

Please add a custom indicator in step "2.5 Indicators" (for instance MY_INDICATOR).
In step "3.1 Expressions" in the Formula window select MY_INDICATOR in the Indicators section. In the Data Parameters dialog box select the Output Stream which you would like to use for calculation
(for instance for variable "label" you should select Output Stream "label"), and period (say, Current).
Then in the Numerical or logical formula field you will see something like this:
MY_INDICATOR.label( 0 )
You should additionally write == 1 (because you have said that you would like to compare the value with 1)
So the formula will be like this:
MY_INDICATOR.label( 0 ) == 1
Set the Internal Name for this formula (for example, expr).
In step "3.2 Activation Points" you should select expr in the Condition window. In the Action window you shuold select Action -> Open Position, Order Side -> Sell. And select for example Close Buy Open Sell radio button.

Re: FX Strategy Wizard Beta

PostPosted: Sat Oct 26, 2013 6:00 pm
by Outside_The_Box
This is cool! I have a question though, aside from the wiki with the walk-through instructions, is there a manual for this anywhere that goes more in depth?

Re: FX Strategy Wizard Beta

PostPosted: Sat Oct 26, 2013 6:06 pm
by Outside_The_Box
Nevermind. I found it in the program folder. LOL

I'll read through it and let you guys know if I have any questions.

Thanks.

Re: FX Strategy Wizard Beta

PostPosted: Sun Oct 27, 2013 5:50 pm
by Outside_The_Box
Okay, I have a question. Am I doing this right? It seems as though I have to enter the same information twice, once in "Expressions" (under formula) and again in "Activation Points" (under condition). Is this necessary?

Image

Image

The strategy is working though, I back-tested it and it is working properly. Not too bad for my first creation. :D

Re: FX Strategy Wizard Beta

PostPosted: Mon Oct 28, 2013 6:03 am
by sunshine
You can use an expression in activation points.
For example, create expressions with formulas and name them as BUY and SELL. And then you can use the created expressions as the condition in the Activation points:
FSW_Step3_1.PNG

FSW_Step3_2.PNG

Re: FX Strategy Wizard Beta

PostPosted: Tue Mar 04, 2014 5:31 am
by nomad_trader
Hi,

I used the wizard to make a strategy for ts2/marketscope.
The strategy works, but only in part: it opens new position but does not close existing positions.
In trying to debug it, I have add some terminal messages at specific points.
I am getting only the messages close-1 and close-2.

I am using the strategy in real account.
Do you have any idea what is wrong and how to fix it?

Function close follows:
-----
Code: Select all
function close(side, offer)
    local enum, row, valuemap;

    enum = core.host:findTable("trades"):enumerator();
    while true do
        row = enum:next();
        if row == nil then
            terminal:alertMessage(instance.bid:instrument(), instance.bid[instance.bid:size() - 1], "close - 1", instance.bid:date(instance.bid:size() - 1));
            break;
        end
        terminal:alertMessage(instance.bid:instrument(), instance.bid[instance.bid:size() - 1], "close - 2", instance.bid:date(instance.bid:size() - 1));
        if row.AccountID == mAccount and
           row.OfferID == offer and
           row.BS == side and
           row.QTXT == mCID then
           terminal:alertMessage(instance.bid:instrument(), instance.bid[instance.bid:size() - 1], "close - 3", instance.bid:date(instance.bid:size() - 1));
            -- if trade has to be closed

            if canClose(row.Instrument) then
                -- create a close market order when hedging is allowed
                terminal:alertMessage(instance.bid:instrument(), instance.bid[instance.bid:size() - 1], "close - 4", instance.bid:date(instance.bid:size() - 1));
                valuemap = core.valuemap();
                valuemap.OrderType = "CM";
                valuemap.OfferID = offer;
                valuemap.AcctID = mAccount;
                valuemap.Quantity = row.Lot;
                valuemap.TradeID = row.TradeID;
                valuemap.CustomID = mCID;
                if row.BS == "B" then
                    valuemap.BuySell = "S";
                else
                    valuemap.BuySell = "B";
                end
                success, msg = terminal:execute(200, valuemap);
                assert(success, msg);
                terminal:alertMessage(instance.bid:instrument(), instance.bid[instance.bid:size() - 1], "close - 5", instance.bid:date(instance.bid:size() - 1));
            else               
                -- create an opposite market order when FIFO
                terminal:alertMessage(instance.bid:instrument(), instance.bid[instance.bid:size() - 1], "close - 6", instance.bid:date(instance.bid:size() - 1));
                valuemap = core.valuemap();
                valuemap.OrderType = "OM";
                valuemap.OfferID = offer;
                valuemap.AcctID = mAccount;
                valuemap.Quantity = row.Lot;
                valuemap.CustomID = mCID;
                if row.BS == "B" then
                    valuemap.BuySell = "S";
                else
                    valuemap.BuySell = "B";
                end
                success, msg = terminal:execute(200, valuemap);
                assert(success, msg);
                terminal:alertMessage(instance.bid:instrument(), instance.bid[instance.bid:size() - 1], "close - 7", instance.bid:date(instance.bid:size() - 1));
            end
        end
    end
end

Re: FX Strategy Wizard Beta

PostPosted: Tue Mar 04, 2014 7:22 am
by nomad_trader
Hi I have posted a message here earlier, but now it is disappearing.
Can you pls bring it back or I have to repost a new one?

Re: FX Strategy Wizard Beta

PostPosted: Wed Mar 05, 2014 11:57 pm
by Valeria
Hi nomad_trader,

Please check the Position Side, it should be the same as the open order side.

Also it would be great if you send the project file or the strategy code at support@gehtsoftusa.com or directly to me via PM or e-mail.

Re: FX Strategy Wizard Beta

PostPosted: Thu Mar 06, 2014 3:12 am
by Apprentice
nomad_trader All post must be approved by a moderator.
Sometimes, for this to happened, it may take several hours.
This is the way the fight with spam.