Tagged: 

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #9751

    edward.samokhvalov
    Participant

    Hello. I just subscribed for a 3 month basic API account and my goal is to get cycle tops and bottoms on 1H or 4H (ideally 4H timeframes).

    Please kindly advise:

    1) The API portal seems to have only daily cycles. Is there a way to get 4H?

    2) Where could I download indicators for MT4 or perhaps I have to upgrade and buy the book the for it (that’s OK too, as the book is around 85 usd, I’ll just need a way to pay that 15 usd difference). If it’s only possible to get cycles on 4H with NinjaTrader it’s fine as well.

    Thank you.

    #9757

    WTT
    Keymaster

    Dear Edward,

    you are welcome. The API is not bound to specific time-frames, so it should be no problem to use 4h or other timeframes. Please check the API developer portal for code examples here: https://www.whentotrade.com/developer-portal/

    The cycle explorer is currently ported with an example to NinjaTrader, I have not included the example for the cycle explorer for mt4. So the cycle explorer runs the same on MT4/MT5, but the code example is currently there for NinjaTrader. So the quickest way to start with cycle detection on a 4h chart is to start with NinjaTrader code example (Link: https://www.whentotrade.com/ninjatrader-cycle-explorer-indicator-code/) and start from there – you should be able to detect FX cycles also on 4H.

    Hope that’s helps and gives direction.

    Regards,
    Lars

     

    #9758

    edward.samokhvalov
    Participant

    Dear Lars, thank you for the answer,

    I’ve managed to create an indicator with this code in NT, but having an issue with the library Newtonsoft.Json (C# is not exactly the framework that I know best except the syntax and a book I’ve read about it more than 10 years ago). Also I have an issue running Excel version. Please advise if I actually have to download the libraries and place them anywhere on the machine. Do I need Visual Studio, perhaps or some .NET SDK?

     

     

     

    #9761

    edward.samokhvalov
    Participant

    I’ve actually got it running, after installing VS, referencing Newton.Json, compiling VS studio project and then adding a reference to DLL from the indicator editor window. Indicator got compiled well, but showed issues while running. Please see the picture. Maybe I have added a reference to the wrong version, I’ve realized there have appeared quite a few of them in the folder of .Net solution “NT Cycle Explorer\packages\Newtonsoft.Json.10.0.3\lib”

    net20
    net35
    net40
    net45
    netstandard1.0
    netstandard1.3
    portable-net40+sl5+win8+wp8+wpa81
    portable-net45+win8+wp8+wpa81

    An advice with Excel would be really handy as well. Thanks.

    #9769

    WTT
    Keymaster

    Dear Edward,

    the main key is that in your indicator folder, the library file “Newtonsoft.Json.dll” should be available. Please check your folder NT folder “…\bin\Custom” (see attached picture). There the file should be places.

    You can also directly import from the provided Ninjatrader Indicator code (download pre-build indicator at the bottom of the article) from this article. The import should directly include and install the Newtonsoft library. Link: https://www.whentotrade.com/ninjatrader-cycleexplorer-indicator

    In regards to manual version/compiler settings: NT 7 is using .net 3.5 and NT8 is using .net 4.5

    Hope that helps!

    Can you tell me which excel file you used? Or even attach it that I can check it directly. Thanks!

    Regards,
    Lars

     

     

     

    #9778

    edward.samokhvalov
    Participant

    Dear Lars,

    I’ve noticed that not all instruments are present in the cycle API, can you please have a look? When we get null returned, does it mean that no cycle is present on an instrument or it means that this instrument is simply not analyzed by the system?

    #9782

    WTT
    Keymaster

    Hi Edward,

    we use the FX data from the ECB. I think they don’t provide any pair. You can check the pairs we have via the ECB here: https://www.whentotrade.com/api-marketcycles/#markets

    If you want other pairs, please use individual datasets via the CycleExplorer endpoint.

    Hope that helps.
    Regards,
    Lars

     

    #9783

    edward.samokhvalov
    Participant

    Thank you, Lars. I’m calling now the cycle explorer api with python, could you please advise on the correct JSON format for quotes to be send?

    Here’s my raw data {date, time, price}, how exactly do I need to format it for https://api.marketcycles.online/api/CycleExplorer  ?

    2013.12.17,20:00,0.83399

    2013.12.18,0:00,0.83446

    2013.12.18,4:00,0.83361

    2013.12.18,8:00,0.83676

    2013.12.18,12:00,0.83432

    #9785

    WTT
    Keymaster

    Hi Edward,

    it is a POST request with the an double array for the quotes. Don’t provide time/date information; just the values in an array of doubles. The engine analyzes the data series point-by-point to derive the cycle information – regardless of the “time per point” information. To get the cycle for the given data series, it doesn’t matter what the time format is per bar.

    See also here: https://api.marketcycles.online/swagger/ui/index#!/MarketCycles/PostCycleExplorer

    You can also review the NT8 code, where the close data is used to send to the API to return the cycle explorer information here: https://www.whentotrade.com/ninjatrader-cycle-explorer-indicator-code/

    Does it help?
    Regards,
    Lars

     

    #9786

    edward.samokhvalov
    Participant

    Dear Lars,

    I tried using Swagger with the data of double values and my API key, see the screenshots with input values over this link

    https://docs.google.com/document/d/1Qdt5j51VqurpCBoGtp4OoAIYCqahqVpr_ljfsAtAVjQ/edit?usp=sharing

    But it shows me an error referring to some “source” parameter, which seems not to exist in API documentation.

    I’ve tried separating quotes with comma and semicolon, it does not work. Pls see the API reply below.

     

    {

    “Message”: “An error has occurred.”,

    <span style=”text-decoration: underline;”>  “ExceptionMessage”: “Value cannot be null.\r\nParameter name: source”,</span>

    “ExceptionType”: “System.ArgumentNullException”,

    “StackTrace”: ”   at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)\r\n   at WTTCyclesAPI.Controllers.MarketCyclesController.<PostCycleDecoder>d__7.MoveNext() in C:\\Users\\lvt\\Documents\\Visual Studio 2017\\Projects\\WTTCyclesAPI\\WTTCyclesAPI\\Controllers\\CyclesController.cs:line 0\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__31.MoveNext()\r\n— End of stack trace from previous location where exception was thrown —\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n— End of stack trace from previous location where exception was thrown —\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n— End of stack trace from previous location where exception was thrown —\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()\r\n— End of stack trace from previous location where exception was thrown —\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()”

    }

    #9788

    edward.samokhvalov
    Participant

    Dear Lars, to make this simpler, I’ve actually created an excel with VBA code that works fine with GET API, but does not work when I try to upload a data series and calculate its cycle. Please kindly check for yourself and let me know what’s causing this error. Thank you in advance.

    #9791

    edward.samokhvalov
    Participant

    fixed it, the array format should have been [323.3232,…,212.22]

    #9795

    WTT
    Keymaster

    glad you figured it out. Does it work now as expected?

    #9800

    edward.samokhvalov
    Participant

    Hi Lars, finally made it work with MT4 and it actually works EXACTLY as I have expected, see the screenshot https://www.mql5.com/en/charts/8172388/nzdchf-h4-forextime-ltd

    For this pic I’ve used CycleDecoder API, green line is a cycle of the green curve, orange – cycle of orange curve and white line is the cycle of the difference between two curves (spread cycle). So I’ll be looking for a signal that makes sure the spread is at the top of the cycle and the two curves would be on the opposites poles (70/-70 or -70/70 something like that), making it a possibility for a conversion of two lines. Historically it looks like a Holy Grail…  A few questions:

    1) How often would it redraw itself while approaching the top of a cycle? Does it redraw only the future or back bars can be redrawn too?

    2) How the length of a period matters in relation to cycle precision? Currently, I use 2000 4H bars. Will I get the same cycles (time wise and value wise) if I feed in 1min bars for the same time period corresponding to that period of 2000 4H bars?

    3) Would you advise t use any specific formula on price, or simple Close is OK and other ways won’t make it more precise?

    4) Do you have somewhere a more detailed description of the parameters of other API function? Maybe CycleExplorer etc.

     

    Thank you!

    #9809

    edward.samokhvalov
    Participant

    Hello, Lars. I’ve been testing various number of data points with an API to see if it keeps giving the same cycles or slightly different ones. I guess the idea is for cycles to be more precise with more data points, but in some decent range. My history is 30k data points, so I went with 500 step: {500, 1000, 1500, 2000….}

    BUT and the last value that API works with is 4500 data points when I send 5000 points to the server, it halts for quite a bit and then shows this error message. Could you advise on this one, please? I’ve attached below the error message and the data set. Thanks.

    <h1>Server Error</h1>
    <h2>502 – Web server received an invalid response while acting as a gateway or proxy server.</h2>
    <h3>There is a problem with the page you are looking for
    and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server
    it received an invalid response from the content server.</h3>

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic.