FX Strategy Wizard Beta

Moderator: admin

Re: FX Strategy Wizard Beta

Postby kevinleijh » Thu Oct 17, 2013 7:16 am

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
kevinleijh
 
Posts: 5
Joined: Thu Jul 11, 2013 9:10 pm

Re: FX Strategy Wizard Beta

Postby Valeria » Fri Oct 25, 2013 12:41 am

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.
Valeria
 

Re: FX Strategy Wizard Beta

Postby Outside_The_Box » Sat Oct 26, 2013 6:00 pm

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?
User avatar
Outside_The_Box
 
Posts: 31
Joined: Tue Apr 02, 2013 5:33 pm

Re: FX Strategy Wizard Beta

Postby Outside_The_Box » Sat Oct 26, 2013 6:06 pm

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.
User avatar
Outside_The_Box
 
Posts: 31
Joined: Tue Apr 02, 2013 5:33 pm

Re: FX Strategy Wizard Beta

Postby Outside_The_Box » Sun Oct 27, 2013 5:50 pm

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
User avatar
Outside_The_Box
 
Posts: 31
Joined: Tue Apr 02, 2013 5:33 pm

Re: FX Strategy Wizard Beta

Postby sunshine » Mon Oct 28, 2013 6:03 am

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
sunshine
 

Re: FX Strategy Wizard Beta

Postby nomad_trader » Tue Mar 04, 2014 5:31 am

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
nomad_trader
 
Posts: 4
Joined: Tue Mar 04, 2014 4:55 am

Re: FX Strategy Wizard Beta

Postby nomad_trader » Tue Mar 04, 2014 7:22 am

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?
nomad_trader
 
Posts: 4
Joined: Tue Mar 04, 2014 4:55 am

Re: FX Strategy Wizard Beta

Postby Valeria » Wed Mar 05, 2014 11:57 pm

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.
Valeria
 

Re: FX Strategy Wizard Beta

Postby Apprentice » Thu Mar 06, 2014 3:12 am

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.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

PreviousNext

Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 8 guests