Grid orders with one combined stop loss and limit, can it be done?

Viewing 15 posts - 61 through 75 (of 308 total)
  • Author
    Posts
  • #6975 quote
    Nicolas
    Keymaster
    Master

    For your development purpose, this is the short code to compute the actual floating profit of the basket :

    //floating profit
    floatingprofit = ((close-positionprice)*pointvalue)*countofposition

    Have a nice day!

    #6976 quote
    simon_json
    Participant
    Average

    Nice Nicolas! Looking forward to the moving stop loss.

    Regarding entry I don’t have much experience regarding recent volatility. Maybe one can use standard deviation in some way?
    I guess one can also use ATR, ADX or chaikin volatility.

    cfta: Can you tell us a little about your entry condition? When, how and why you choose to start the strategy?

    #7025 quote
    Nicolas
    Keymaster
    Master

    I think cfta use some kind of technical analysis but I maybe wrong, so I don’t think that his strategy can be automatized.

    I’m actually working on a risk/reward system for the moving stop loss. How do you think it would be done? Actually, I authorized the trailing of the stoploss when the floating profit reached at least a risk/reward x factor. I put this value into a variable for convenience. But then, how does the stoploss should be moved? With a profit percent step?

    #7038 quote
    simon_json
    Participant
    Average

    Awesome Nicolas!
    Since it a trend following system my guess is that the hit rate will not be very very high, so in that case we need big profits when winning and small losses when losing. And that is exactly what I think this system can do 🙂

    To start trailing when the floating profit reached at least a risk/reward x factor sound very good! ProRealTimes term “profit percent step”, is actually a new term for me because of my background from MetaTrader, so I’m not sure how ProRealTime calculate that.
    But I think as long as there is enough space between market and trailing stop, I think thats perfect! Enough so the market can do its magic 🙂 but of course not to big so the market can do its other magic resulting in a loss (But that is of course taking care of with the “To start trailing when the floating profit reached at least a risk/reward x factor sound”). Its a balancing act.

    Maybe ProOrder will require a profit percent step because of the basket of orders?
    Maybe the Trailing stop moves could be based on volatility, maybe with ATR? When high volatility, means bigger distance from market, and when low volatility – smaller distance from market?
    Or maybe maybe distance based on time, first bigger distance between trailing stop and market, and later on smaller distance. It could make sense if a big move means high volatility and then the following consolidation means lower volatility, but Im not sure if it means that 🙂

    I like sometimes to use PSAR as a trailing step, I think it calculate volatility as well. But sometimes it don’t work, in my testings it has also lead to curve fitting I think.

    My best suggestion is that as long there is enough distance between trailing step and market, anything will be very fine! 🙂
    And maybe if the Trailing stop moves could be based on volatility, maybe with ATR?

    All the best!

    Namnlös10.png Namnlös10.png
    #7044 quote
    simon_json
    Participant
    Average

    Maybe a Trailing stop based on 3 ATR calculated from the securities highest price. ATR value is based on the last x bars of Average True Range.

    All the best!

    #7052 quote
    Nicolas
    Keymaster
    Master

    Thanks Simon for all your ideas.

    I can test ATR distance from price of course. But, since we focus on money management, maybe we should only talk about profit and not only price.

    The ‘floatingprofit’ variable is set. We can add any mathematical indicator on its value, like a moving average.

    I used to do research on equity curve trading, and I found that deviation from the mean of your floating profit curve is a good option to :

    1/ keep money safe (because we can exit before a new trend occur)

    2/ avoid market whipsaw and keep trades on line (because testing a deviation of a moving average is better to only test an average alone which tends to be too much close with the profit curve)

    Maybe you have already understand it, but we can add a simple lower bollinger band (which is a 2 standard deviation from a 20 period moving average) on the floating profit curve. If profit cross this deviation, it’s an exit.

    Also, like I said earlier in this thread, this exit option will be set only if the risk reward ratio has been reached.

    #7062 quote
    simon_json
    Participant
    Average

    You’re welcome! 🙂
    Oh yes, you are right, I meant a Trailing stop based on 3 ATR calculated from the securities highest ‘floatingprofit’. ATR value is based on the last x ‘floatingprofit’ of Average True Range. But I don’t know if its possible 🙂

    What you suggest sounds really good, deviation from the mean of your floating profit curve. I am sure that you are themost experienced 🙂

    Yes it will be interesting to see the systems winning % hit ratio regarding risk reward 🙂

    #7064 quote
    Brage
    Participant
    Senior

    Hi guys

    Nice work and interesting:)  A suggestion: In the attached pdf there is a money management idea that I’ve tested a little and I’ve wanted to test it in an automated strategy but I don’t know how to code it. It is the relation between the risk unit and the move of the stop to lock in a profit that I find interesting and after these steps start trailing as suggested before.. Maybe it can be combined with the grid code in a complete strategy.

    By the way, is there a long side version? 🙂

    As I see it this could be at way to lock in some profit and then start trailing as mentioned above.

    Money-management.pdf
    #7073 quote
    cfta
    Participant
    Senior

    I’m glad to see all these suggestions and ideas!

    As for profit protection, standard deviation from the floating profit when R:R x is reached sounds like an amazing idea since the worst enemies of this systems are retracements and whipsaws, I would love to try it with a bollinger band cross.
    Regarding how I pick my entries Nicolas is right, I base my decisions on technical analysis mainly on the H4 timeframe, using MACD, Heiken Ashi, Heiken Ashi Smoothed, MA, a CCI histogram, a custom MTF ADX matrix, MTF ATR for reference of determining number of pips for SL and target. I used to trade a basket of currencies which you can read more about here, though now I have replaced the IXOAH with MACD and switched ADX indicator;
    That post is over 2 years old but I have not changed my trading that much since then, since I started using PRT just over two months ago I still check my MT4 charts along with PRT because it’s easier for me to spot the trades there until I have spent more hours getting accustomed to the PRT charts.
    While testing the system I started it on GBPCAD on Monday last week at a very good level which I posted here;
    The attached screenshot shows how my MT4 chart looked and I guess it’s pretty obvious why I took it when looking at the indicators (note that the ADX matrix and ATR average doesn’t show the data for that time but from Friday’s market close), the exit may have been premutare but since the MACD started showing signs of a reversal I called it quits.
    I think it would be rather challenging to automate my entry strategy in particular to avoid ranging markets when losses can rack up quickly. However creating a market scan to find the oppurtunities and then verify the setup manually and then starting the system can be very useful, alternatively semi-automating entries creating an alert when the setup occurs and requiring a manual confirmation to start the system.
    Unrelated to the above the system can be used when anticipating market events causing heavy volatility such as central bank rate decisions with uncertain outcome and market direction. In those scenarios we want to start the system one two charts of the symbol, one going long and the other going short. If price takes of in either direction with only moderate whipsaw and retrace we will lose 1 % on one side but strike gold on the other! Recent opportunities include the Bank of Japan rate decision on virtually any JPY pair but let’s take a look at GBPJPY which would have racked up 500+ pips within hours which would give us over 37 % profit or even more if holding for a day or two and don’t get me started on the 1200+ pips moev on the Nikkei at the same time! A similar opportunity occured on 3rd May after the RBA rate decision, smaller amount of pips but still nice profits 🙂
    We have many great things to come my friends!
    PRT-grid-progress-3-1.png PRT-grid-progress-3-1.png GBPCAD-20160502.png GBPCAD-20160502.png GJ-BOJ-April.png GJ-BOJ-April.png
    #7081 quote
    Nicolas
    Keymaster
    Master

    @Brage

    Why not opening a new thread for your idea? Thanks in advance 🙂


    @cfta
    & simon

    The code is almost done, but my platform is quiet stuck for the moment because I’m optimizing some strategies for a customer.

    I haven’t read the whole thread on FF but this strategy can be surely automated, but as you pointed it, it could be also very difficult to avoid ranging market.. still same combat here and there .. 🙂

    With PRT we have a wonderful tool called ProScreener, this is definitely what your strategy needs to be semi-automatized. Maybe you could describe a bit this strategy in a new topic and we’ll build its screener and develop there.

    #7150 quote
    Brage
    Participant
    Senior

    Hi Nicolas

    Can I use the code for floatingprofit to set a target on a fixed amount and if so how is it done? Trying to combine a breakout system with the grid order code, se attached.

    Thanks!

    Test-brekoutgrid.itf
    #7153 quote
    Nicolas
    Keymaster
    Master

    Yes Brage, just test the floatingprofit variable if its superior to your fixed takeprofit amount and then close all trades with SELL and EXITSHORT instructions.

    #7155 quote
    Brage
    Participant
    Senior

    Tried these but can’t figure whats wrong.

    //set target with floating
    if shortonmarket and flotingprofit=>400 then EXITSHORT AT MARKET
    endif
    if longonmarket and flotingprofit=>400 then SELL AT MARKET
    endif

    Thanks for your help:)

    #7156 quote
    Nicolas
    Keymaster
    Master

    Your code should be formatted like this instead:

    //set target with floating 
    if shortonmarket and floatingprofit=>400 then 
     EXITSHORT AT MARKET 
    endif
    if longonmarket and floatingprofit=>400 then 
     SELL AT MARKET 
    endif
    #7188 quote
    cfta
    Participant
    Senior

    Hello guys,

    I have spent part of the weekend trying to figure out which parameters to use for a market screener since finding good setups is a little different when using a coded system rather than just glancing at it and recognizing a setup. My strategy for picking entries is pretty good but there is probably a fair amount of room for improvement, that said some of the exiting screeners on forum might be more useful, I’m looking to test MikcGC’s Bullish/Bearish and the TDI screeners this week and gain some insight.

    Nicolas I have continued the live testing and everything looks good with the exception of JPY pairs where I seem to get stopped out very soon after entry by very small retraces, can this be some sort of decimal issue or that the system count amount of JPY lost rather than the base currency? Please have a look…

    defparam preloadbars = 0
    
    //parameters
    accountbalance = 10000 //account balance in money at strategy start
    riskpercent = 1 //whole account risk in percent%
    gridstep = 20 //grid step in point
    amount = 1 //lot amount to open each trade
    
    //first trade whatever condition
    if NOT ONMARKET AND close>close[1] AND STRATEGYPROFIT=0 then
    BUY amount LOT AT MARKET
    endif
    
    // case BUY - add orders on the same trend
    if longonmarket and close-tradeprice(1)>=gridstep*pipsize then
    BUY amount LOT AT MARKET
    endif
    
    //money management
    liveaccountbalance = accountbalance+strategyprofit
    moneyrisk = (liveaccountbalance*(riskpercent/100))
    onepointvaluebasket = pointvalue*countofposition
    
    //GRAPH mindistancetoclose as "d"
    
    //stoploss trigger
    if onmarket then
    mindistancetoclose =(moneyrisk/onepointvaluebasket)*pipsize
    SELL AT positionprice-mindistancetoclose STOP
    endif
    
    PRT-grid-error-14.png PRT-grid-error-14.png
Viewing 15 posts - 61 through 75 (of 308 total)
  • You must be logged in to reply to this topic.

Grid orders with one combined stop loss and limit, can it be done?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
cfta @cfta Participant
Summary

This topic contains 307 replies,
has 1 voice, and was last updated by OtherAttorney
1 year, 10 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/14/2016
Status: Active
Attachments: 106 files
Logo Logo
Loading...