DailyFX Home | Español | Français | 中文 | Deutsch | Italiano | العربية | Sverige | Ελληνικά


+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 18
  1. #1
    AnkaSoftware is offline Member AnkaSoftware is an unknown quantity at this time
    Join Date
    Jan 2012
    Posts
    9

    Strategy Parameters and QTXT/Comment

    Hi,
    Had a couple of clarifications:
    a) Is it possible to see the QTXT/Comments column in TradeStation.
    b) Does change in Parameters of a Strategy, does a restart of strategy - ie all global LUA variables getting reset, or there is no restart.

    Thanks in advance.

    Regards

    Anka Software

  2. #2
    Natalya is offline Gold Member Natalya is an unknown quantity at this time
    Join Date
    Apr 2009
    Posts
    642
    Hello,

    Quote Originally Posted by AnkaSoftware View Post
    a) Is it possible to see the QTXT/Comments column in TradeStation.
    It is not displayed in TradingStation. But you can print this text to display it in the Events window (Alerts and Trading Automation -> Show Events).

    Quote Originally Posted by AnkaSoftware View Post
    b) Does change in Parameters of a Strategy, does a restart of strategy - ie all global LUA variables getting reset, or there is no restart.
    If you change some strategy parameter, the strategy will be restarted. But you can use the method ChangeParameters() to change the parameters "on the fly" without the restarting of the strategy instance. For details please see ChangeParameters()

    I hope this will help.

  3. #3
    AnkaSoftware is offline Member AnkaSoftware is an unknown quantity at this time
    Join Date
    Jan 2012
    Posts
    9
    Natalya,
    Thanks for the replies.

    Another query. In a strategy, I place a LE order, and want to wait till the entry appears in the 'Orders' table.

    As per the example given in FXCodeBase.COM: Forex Chart Indicators and Development • Search, I wait for the call to function "ExtAsyncOperationFinished", and do the check core.host:execute("isTableFilled", "orders").

    However this 'wait' for the LE order to appear in the 'Orders' (or Trades) table is not working Please advice.

    Thanks in advance.

  4. #4
    Natalya is offline Gold Member Natalya is an unknown quantity at this time
    Join Date
    Apr 2009
    Posts
    642
    Please make sure that you have included helper lua in your strategy code:
    Code:
    dofile(core.app_path() .. "\\strategies\\standard\\include\\helper.lua");
    If this won't help, could you please provide code snippet how do you 'wait' for the order to appear in the table.

  5. #5
    AnkaSoftware is offline Member AnkaSoftware is an unknown quantity at this time
    Join Date
    Jan 2012
    Posts
    9
    Natalya,
    I have included the line regarding the code in my strategy.

    Code for waiting for order to execute (taken from samples in the manual) is as follows:

    Code:
    execute;
    
    function ExtUpdate(id, source, period)  -- The method called every time when a new bid or ask price appears.
    
    
        -- Wait for asynchronous ie orders operations to finish
        if executing then
             core.host:trace("Executing Returning ");
            return ;
        end
    
        if (not checkReady("Trades")) or (not checkReady("Orders")) or (not checkReady("Offers") or (not checkReady("Closed Trades"))) then
            core.host:trace("Table filled Returning ");
            return false;
        end
    ...
        enterOrders()
    ...
    ...
    end
    
    function ExtAsyncOperationFinished(cookie, successful, message)
        
        if cookie == 100 then
    
            executing = false;
            if not successful then
               assert(successful, message);
                return;
            end
        end
    end
    
    function checkReady(table)
        local rc;
        if Account == "TESTACC_ID" then
            -- run under debugger/simulator
            rc = true;
        else
            rc = core.host:execute("isTableFilled", table) && core.host:execute("isReady", table);
        end
        return rc;
    end
    
    function enterOrders()
    ...
    ...
    ...
    
        executing = true;
        success, msg = terminal:execute(100, valuemap);
    
            
        if not(success) then
            executing = false;
            terminal:alertMessage(instance.bid:instrument(), instance.bid[instance.bid:size() - 1], "alert_ExitOrderFailed" .. msg, instance.bid:date(instance.bid:size() - 1));
        end
    end
    dofile(core.app_path() .. "\\strategies\\standard\\include\\helper.lua");

  6. #6
    Natalya is offline Gold Member Natalya is an unknown quantity at this time
    Join Date
    Apr 2009
    Posts
    642
    Thank you for the response.

    Looks like there are no issues in the code. This should work. But I have forwarded it to developers to get the confirmation from them. I will let you know about results.

  7. #7
    AnkaSoftware is offline Member AnkaSoftware is an unknown quantity at this time
    Join Date
    Jan 2012
    Posts
    9
    Natalya,
    Will await for your response on ExtAsyncOperationFinished.

    Going back to earlier query on Strategy restarts, is there any way to save internal variables of Strategy across two 'sessions', something similar to MT4 global variables?

  8. #8
    sibvic is offline Bronze Member sibvic is an unknown quantity at this time
    Join Date
    Nov 2010
    Posts
    24
    Quote Originally Posted by AnkaSoftware View Post
    Code:
    ...
            rc = core.host:execute("isTableFilled", table) && core.host:execute("isReady", table);
    ...
    Is it a misprint on the forum or this string from your strategy?
    It should be rc = core.host:execute("isTableFilled", table) and core.host:execute("isReady", table);

  9. #9
    sibvic is offline Bronze Member sibvic is an unknown quantity at this time
    Join Date
    Nov 2010
    Posts
    24
    Quote Originally Posted by AnkaSoftware View Post
    Natalya,
    Will await for your response on ExtAsyncOperationFinished.

    Going back to earlier query on Strategy restarts, is there any way to save internal variables of Strategy across two 'sessions', something similar to MT4 global variables?
    You can use Persistent Storage (Example)

  10. #10
    AnkaSoftware is offline Member AnkaSoftware is an unknown quantity at this time
    Join Date
    Jan 2012
    Posts
    9
    Thanks Sibvic.

    After incorporating the storagedb related code, I got an error on missing files, when I tried to load strategy into Marketscope demo account.. I have copied the storagedb.dll from \IndicoreSDKt folder to FXTS2 folder. Any other files required apart? I am still getting others when I try to use storagedb.

  11. #11
    Natalya is offline Gold Member Natalya is an unknown quantity at this time
    Join Date
    Apr 2009
    Posts
    642
    Please refer to this thread to see how to resolve the problem:

    FXCM TSII Version 01.11.111711 StorageDB problem

    I do appologize for the inconvenience.

  12. #12
    AnkaSoftware is offline Member AnkaSoftware is an unknown quantity at this time
    Join Date
    Jan 2012
    Posts
    9
    Natalya,
    Thanks.

    a) Any update on the ExtAsyncOperationFinished query?
    b) I am getting occasional errors "The Entry,Stop or Limit price you are entering is incorrect .. " in the Strategy. I have a check that the Entry price is more than 1 pip away from market price, else I go for OM orders. Any other checks to be added / sample code for same available?

  13. #13
    Natalya is offline Gold Member Natalya is an unknown quantity at this time
    Join Date
    Apr 2009
    Posts
    642
    Quote Originally Posted by AnkaSoftware View Post
    a) Any update on the ExtAsyncOperationFinished query?
    I'm afraid we couldn't re-create the issue. Could you please provide the full code of the strategy? If it is not for public, you can send it to e-mail: support (at) gehtsoftusa dot com.

    Quote Originally Posted by AnkaSoftware View Post
    b) I am getting occasional errors "The Entry,Stop or Limit price you are entering is incorrect .. " in the Strategy. I have a check that the Entry price is more than 1 pip away from market price, else I go for OM orders. Any other checks to be added / sample code for same available?
    If you use peg orders, you should pass the order price in pips (for example, 50 pips, do not use converted values such as 0.0050).
    Such an error can also occur on ranging market when the price is changed fast. So if the price of your order is close to the market price, it may become invalid while sending the request for execution.
    Last edited by Natalya; 01-25-2012 at 06:15 AM. Reason: a typo corrected

  14. #14
    AnkaSoftware is offline Member AnkaSoftware is an unknown quantity at this time
    Join Date
    Jan 2012
    Posts
    9
    a) ExtAsyncOperationFinished
    Will send the code sample to reproduce the problem shortly
    b) Error "The Entry,Stop or Limit price you are entering is incorrect .. "
    I am using Stop Order for an existing position with the Rate specified and TrailUpdatePips set to 1. Any way to suppress the errors/warning and not to let Strategy to stop?

  15. #15
    AnkaSoftware is offline Member AnkaSoftware is an unknown quantity at this time
    Join Date
    Jan 2012
    Posts
    9
    Another question - How do I find out, if a Stop is attached to a trade, all Trade row parameters viz, Stop, StopOrderID etc return <blank> or nil values?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Disclaimer: Trading foreign exchange on margin carries a high level of risk, and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to trade foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with foreign exchange trading, and seek advice from an independent financial advisor if you have any doubts. Any opinions, news, research, analyses, prices, or other information contained on this website is provided as general market commentary and does not constitute investment advice. Forex Capital Markets LLC. will not accept liability for any loss or damage, including without limitation to, any loss of profit, which may arise directly or indirectly from use of or reliance on such information.