It will check two time frames, higher tf to validate the trend, lower to search for the setup. The two time frames can be selected by user either (manual entry both time frames, or manually enter lower timeframe with a multiplier to auto derive the higher time HTF=LTM*multiplier)
1) for each bar on both LTF and HTF identify troughs and peaks without using zigzag function or functions that look into the future bars to make backtesting realistic. The following will be applied for both time frames:
1.1) if L(1)>L(2)>L(3) and L(3)<L(4)<L(5)<L(6) then assign value to L(3)'s barID = trough (true)
1.2) if H(1)<H(2)<H(3) and H(3)>H(4)>H(5)>H(6) then assign value to H(3)'s barID = Peak (true)
1.3) initiate a new loop to check if current bar's low doesn't go below previously identified Trough's low, if so, mark the broken trough bar with TBroken=true
Also check if current bar high go above any previous Peak's high, if so, mark that peak with PBroken=true
2) in the HTF, compare location of current bar's close price relative to nearest previous TROUGH below current close and nearest PEAK above current close, if current close falls in the lower third of the range (nearest peak high minus nearest trough low), then assign HTF_Check=true
3) In the LTF, do a new loop to identify trades as following:
3.1) if current bar Low = nearest trough's Low plus/minus x% and TBroken=false and HTF_Check=true, then buy market with initial stop= nearest trough's Low minus y%. And initial Target to sell z% of position at nearest Peak that are still not penetrated (ie still PBroken=false for that specific peak).
x, y, z % are user input parameter
Once last trade >= initial target level or stop loss set during entry stage is hit, whichever comes first, sell.
If initial target was touched first, sell z% of the trade position size at market, and keep the remaining position quantity open until trailing stop hits.
If stop level is hit, sell all remaining quantity of open position at market price.
If non happened, move the trail stop to (nearest LTF Trough + nearest HTF Trough)/2
There will be long only trades. A single leg call option contract, with strik level below the initial stop price, and expiry of more than 90 days of trade date, and position size that is based on user selected parameter ( % of total account net worth, or % of remaining buying power, or fixes $ amount).
The code should for a selected watch list of symbols (manually selected), run every (time interval as input parameter) to find trading oppourtionities that matches the needed setup. Once condition is true for any Sympol, an automatic trade is placed on an option call as market order
2 freelancer bu iş için ortalamada 150$ teklif veriyor
Hi, Am an Algorithm trader acquainted with TradeStation's easy language since it was Omega Tradestation 2000i. I will code your TradeStation strategy exactly as u have [url removed, login to view] you find my bid reasonable kindly al Daha fazlası