How to use indicator in an strategy

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #53401 quote
    Juan Salas
    Participant
    Master

    Hi colleagues,

    I have been checking the PRT probuilder manual, and I need help to understand how to use an indicator into an strategy. There are many indicators that display pivotal points as arrows (x1,y1) and ellipses (x1, y1, x2, y2). It is very interesting for automatic trading to take this points (arrows) to place orders.

    My question is how can I program a buy or sell order in reference to these points?

    I have checked the blogs but I couldn’t find any reference about this. I would appreciate any links to this kind of information, or a brief example of a coded order.

     

    Thanks in advance for any help,

    Juan

    #53406 quote
    Despair
    Blocked
    Master

    Just copy the indicator the code in your code. Then you have the parameters in the variables and can use it to generate orders.

    #53408 quote
    Juan Salas
    Participant
    Master
    Thanks Despair, I have been trying to convert an indicator into an strategy, but when it comes to formulate the orders, I have to eliminate the drawing objects, and thus, I eliminate some of the conditions that create those drawings. So I thought if would be easier to use the complete indicator and then the strategy “calling” the indicator, but the problem is what do you put into the buying order. IF (x1,y1) THEN BUY… ENDIF
    #53415 quote
    Despair
    Blocked
    Master

    You must remove all drawing commands. The x-coordinate is usually the barindex and the y-coordinate is where you want to place your order (close crosses over Y1 or something like this).

    Nicolas and Juan Salas thanked this post
    #53424 quote
    robertogozzi
    Moderator
    Master

    After removing all graphic command, as Despair said, you may use the conditions that caused the command to be executed as your conditions in your strategy. Example (taken from a Candlestick pattern recognizer):

    MorningStar=(body[2]<0 and body>0 and longcandle[2] and open[1]<close[2] and open>close[1] and ratio[1]<0.3 and abody[1]<abody[2] and abody[1]<abody and low[1]<low and low[1]<low[2] and high[1]<open[2] and high[1]<close)
    if TrendDown[3] AND MorningStar then
       DRAWTEXT("Morning Star", barindex, low[1]-atr*1.5, Dialog, Standard, 12) COLOURED(0,155,10)
       DRAWARROWUP(barindex-1,low[1]) COLOURED(0,155,10)
    endif
    when embedded into your strategy will look like this:
    MorningStar=(body[2]<0 and body>0 and longcandle[2] and open[1]<close[2] and open>close[1] and ratio[1]<0.3 and abody[1]<abody[2] and abody[1]<abody and low[1]<low and low[1]<low[2] and high[1]<open[2] and high[1]<close)
    if TrendDown[3] AND MorningStar then
       .  //either go LONG or set other variables
       .  //you know this the point where an arrow UP would have been drawn, so it's
       .  //likely you have to go LONG here
    endif
     
    Nicolas, Juan Salas and Ste thanked this post
    #53442 quote
    Juan Salas
    Participant
    Master
    Hi guys @Despair,@Roberto, Thanks so much for your help, That is what I did. I removed all graphics command from the code and replaced them with the order. If it said DRAWARROWUP I went LONG and such… But in the case of the Indicator WILLIAMSHIGHANDLOW, removing the command DRAWELLIPSE, which it was a swing pivotal point of importance, disrupted the indicator and screwed the strategy code, since (x1,y1,x2,y2) was part of the code. But, knowing it is the way, I will do it that way. Thanks so much for your help, Juan
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

How to use indicator in an strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Juan Salas @juan-salas Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by Juan Salas
8 years, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/21/2017
Status: Active
Attachments: No files
Logo Logo
Loading...