ProRealCode - Trading & Coding with ProRealTime™
Newbie type Questions & Answers
Actually this was the write place,Yeah … glad you found your literary repository! 🙂 I had vision of you thinking … well eff me they’ve deleted all my work!!!! 🙂 🙂
BUY 1 PERPOINT AT MARKET” I’d say “BUY 0.2 PERPOINT AT MARKET” and that’ll work?Yes
So with the 4,877 you tried on the NikkeiI never said that. It is 4,877 tried on about 10 Instruments and a few more tried now and again.
Then I turned half of those notes into audio books that I listen too from time to time lolYou should put them on Youtube … you might make money from google ads etc
is there a way to keep algos open if they have a trade rejected for insufficient funds?No apart from lodge any shares you own as collateral and a percentage of their current price will be taken into account as more funds.
strategy that stops all strategies when your overall account is down like £500 for the day or something?Monitor (every hour) the ‘Detailed Report’ (under View) for a particular Platform and stop your strategies when getting close to £500 Loss for the Day.
Actually this was the write placeThe right place for a place to write.
So do you only trade one instrument and one strategy at a time?I did have 3 to 5 Auto-Systems on £0.2 per point each … most on the DJI due to large Daily ATR. This week I have all Systems switched off Real Live as all I was doing was making up the losses on Auto-Systems by manual trading! Demoralising? I am going through a ‘ not trust Algo’s phase’ again! 🙂
So how would I do this?https://www.ig.com/uk/help-and-support/investments/share-dealing-and-isas/how-do-i-set-up-collateral
genuinely think I’ll do that.Let us know when you do … I’ll have a listen! 🙂
How is everyone back testing strategies with any 1minute parameters if they can only see how it did in the last 2 days?With frustration! 🙂 But you should get about a week on 1 min TF? 2 days sounds more like sub 1 min (seconds) TF?
Or maybe just stricter entry requirements to keep you away from fake breakouts?I can’t see much of a game changer until we get v11 and arrays? But even then how many of us are capable of coding with arrays? We need Elliott Waves to be taken account of as that is how markets move. I’m kinda hoping there may some good Algo’s for sale (at a reasonable price) on Nicolas Market Place when it gets up and running?
How do you set up a stop loss on your whole account or on a strategy that stops all strategies when your overall account is down like £500 for the day or something?Vonasi wrote a Money Management code you might like. There’s a variable fuse to stop the strategy after x% drawdown.
//MONEY MANAGEMENT Capital = 10000 MinSize = 1 //The minimum position size allowed for the instrument. MM1stType = 0 //Starting type of moneymanagement. Set to 0 for level stakes. Set to 1 for increasing stake size as profits increase and decreasing stake size as profits decrease. Set to 2 for increasing stake size as profits increase with stake size never being decreased. MM2ndType = 1 //Type of money management to switch to after TradesQtyForSwitch number of trades and ProfitNeededForSwitch profit has occurred TradesQtyForSwitch = 10 //Quantity of trades required before switching to second money management choice. ProfitNeededForSwitch = 3 //% profit needed before allowing a money management type change to MM2ndType. DrawdownNeededToSwitch = 5 //% draw down from max equity needed before money management type is changed back to MM1stType. DrawdownNeededToQuit = 25 //% draw down from max equity needed to stop strategy Once MoneyManagement = MM1stType Equity = Capital + StrategyProfit maxequity = max(equity,maxequity) if equity < maxequity * (1 - (DrawdownNeededToSwitch/100)) then enoughtrades = 0 tradecount = 0 moneymanagement = MM1stType endif if equity < maxequity * (1 - (DrawdownNeededToQuit/100)) then quit endif if not EnoughTrades then if abs(countofposition) > abs(countofposition[1]) then tradecount = tradecount + 1 endif if tradecount > TradesQtyForSwitch and maxequity >= Capital * (1 + (ProfitNeededForSwitch/100)) then EnoughTrades = 1 MoneyManagement = MM2ndType endif endif IF MoneyManagement = 1 THEN PositionSize = Max(MinSize, Equity * (MinSize/Capital)) ENDIF IF MoneyManagement = 2 THEN PositionSize = Max(LastSize, Equity * (MinSize/Capital)) LastSize = PositionSize ENDIF IF MoneyManagement <> 1 and MoneyManagement <> 2 THEN PositionSize = MinSize ENDIF PositionSize = Round(PositionSize*100) PositionSize = PositionSize/100 // Size of POSITIONS PositionSizeLong = 1 * positionsize PositionSizeShort = 1 * positionsize
IF NOT ONMARKET AND (PositionPerf(1) + PositionPerf(2) + PositionPerf(3) + PositionPerf(4)) < -100 OR STRATEGYPROFIT < -100 THEN
QUIT
ENDIF
Does this part stop the strategy if it loses 100 points (which could be £500) or does it stop it even if it loses 20 points but I’m £100 down?
//trailing stop function (make equal to absolute value when trailing stop and absolute value)
IF CountOfPosition < 2 AND ONMARKET AND PositionPerf(1) > 0 THEN
//trailing will start @trailinstart points profit
TRSTART = (ATR*0.50)*40
//trailing step to move the "stoploss"
TRSTEP = (ATR*0.50)*4
// Target profit = S*T
TKPROFIT = (ATR*0.50)*16
ENDIF
IF CountOfPosition < 2 AND ONMARKET AND PositionPerf(1) <= 0 THEN
//trailing will start @trailinstart points profit
TRSTART = (ATR*0.25)*40
//trailing step to move the "stoploss"
TRSTEP = (ATR*0.25)*4
// Target profit = S*T
TKPROFIT = (ATR*0.25)*16
ENDIF
Does this part say only use (ATR*0.50) when the last trade won but if it’s breakeven or under then use (ATR*0.25) instead as a multiple for TRSTART, TKPROFIT AND TRSTEP? An if not how do I say that?
//within reach of the take profit
IF Close-TRADEPRICE(1)>(TKPROFIT*0.9) AND CountOfPosition < 3 AND LONGONMARKET THEN
BUY 1 PERPOINT AT MARKET
ENDIF
IF TRADEPRICE(1)-Close>(TKPROFIT*0.9) AND CountOfPosition < 3 AND SHORTONMARKET THEN
SELLSHORT 1 PERPOINT AT MARKET
ENDIF
Also does this code say when the Price reaches 90% of the original take profit level then buy and/or short sell a 2nd share? An if not how would I say that? I’ve tried but it doesn’t seem to be working. Also could you also help me with a version of this that says the exact same thing but to buy and/or short sell a second share when the price is within 6 points of the original take profit level.
<pre class=”lang:probuilder decode:true” title=”3 Things”>DEFPARAM CumulateOrders = True // Cumulating positions deactivated
ATR = AverageTrueRange[186]
//take profit
SET TARGET pPROFIT TKPROFIT
IF NOT ONMARKET AND (PositionPerf(1) + PositionPerf(2) + PositionPerf(3) + PositionPerf(4)) < -100 OR STRATEGYPROFIT < -100 THEN
QUIT
ENDIF
//trailing stop function (make equal to absolute value when trailing stop and absolute value)
IF CountOfPosition < 2 AND ONMARKET AND PositionPerf(1) > 0 THEN
//trailing will start @trailinstart points profit
TRSTART = (ATR*0.50)*40
//trailing step to move the “stoploss”
TRSTEP = (ATR*0.50)*4
// Target profit = S*T
TKPROFIT = (ATR*0.50)*16
ENDIF
IF CountOfPosition < 2 AND ONMARKET AND PositionPerf(1) <= 0 THEN
//trailing will start @trailinstart points profit
TRSTART = (ATR*0.25)*40
//trailing step to move the “stoploss”
TRSTEP = (ATR*0.25)*4
// Target profit = S*T
TKPROFIT = (ATR*0.25)*16
ENDIF
//reset the stoploss value
IF NOT ONMARKET THEN
SPLOSS = 0
ENDIF
//manage long positions
IF LONGONMARKET THEN
//first move (breakeven)
IF SPLOSS = 0 AND close-TradePrice(1)>=TRSTART THEN
SPLOSS = TradePrice(1)+TRSTEP
ENDIF
//next moves
IF SPLOSS > 0 AND close-SPLOSS>TRSTEP THEN
SPLOSS = SPLOSS+TRSTEP
ENDIF
ENDIF
//manage short positions
IF SHORTONMARKET THEN
//first move (breakeven)
IF SPLOSS = 0 AND TradePrice(1)-close>=TRSTART THEN
SPLOSS = TradePrice(1)-TRSTEP
ENDIF
//next moves
IF SPLOSS> 0 AND SPLOSS-close>TRSTEP THEN
SPLOSS = SPLOSS-TRSTEP
ENDIF
ENDIF
//stop order to exit the positions
IF SPLOSS > 0 THEN
SELL AT SPLOSS STOP
EXITSHORT AT SPLOSS STOP
ENDIF
//put the first stoploss
IF ONMARKET AND SPLOSS = 0 THEN
SET STOP pTRAILING TRSTART
ENDIF
//within reach of the take profit
IF Close-TRADEPRICE(1)>(TKPROFIT*0.9) AND CountOfPosition < 3 AND LONGONMARKET THEN
BUY 1 PERPOINT AT MARKET
ENDIF
IF TRADEPRICE(1)-Close>(TKPROFIT*0.9) AND CountOfPosition < 3 AND SHORTONMARKET THEN
SELLSHORT 1 PERPOINT AT MARKET
ENDIF
DEFPARAM CumulateOrders = True // Cumulating positions deactivated
ATR = AverageTrueRange[186]
//take profit
SET TARGET pPROFIT TKPROFIT
IF NOT ONMARKET AND (PositionPerf(1) + PositionPerf(2) + PositionPerf(3) + PositionPerf(4)) < -100 OR STRATEGYPROFIT < -100 THEN
QUIT
ENDIF
//trailing stop function (make equal to absolute value when trailing stop and absolute value)
IF CountOfPosition < 2 AND ONMARKET AND PositionPerf(1) > 0 THEN
//trailing will start @trailinstart points profit
TRSTART = (ATR*0.50)*40
//trailing step to move the "stoploss"
TRSTEP = (ATR*0.50)*4
// Target profit = S*T
TKPROFIT = (ATR*0.50)*16
ENDIF
IF CountOfPosition < 2 AND ONMARKET AND PositionPerf(1) <= 0 THEN
//trailing will start @trailinstart points profit
TRSTART = (ATR*0.25)*40
//trailing step to move the "stoploss"
TRSTEP = (ATR*0.25)*4
// Target profit = S*T
TKPROFIT = (ATR*0.25)*16
ENDIF
//reset the stoploss value
IF NOT ONMARKET THEN
SPLOSS = 0
ENDIF
//manage long positions
IF LONGONMARKET THEN
//first move (breakeven)
IF SPLOSS = 0 AND close-TradePrice(1)>=TRSTART THEN
SPLOSS = TradePrice(1)+TRSTEP
ENDIF
//next moves
IF SPLOSS > 0 AND close-SPLOSS>TRSTEP THEN
SPLOSS = SPLOSS+TRSTEP
ENDIF
ENDIF
//manage short positions
IF SHORTONMARKET THEN
//first move (breakeven)
IF SPLOSS = 0 AND TradePrice(1)-close>=TRSTART THEN
SPLOSS = TradePrice(1)-TRSTEP
ENDIF
//next moves
IF SPLOSS> 0 AND SPLOSS-close>TRSTEP THEN
SPLOSS = SPLOSS-TRSTEP
ENDIF
ENDIF
//stop order to exit the positions
IF SPLOSS > 0 THEN
SELL AT SPLOSS STOP
EXITSHORT AT SPLOSS STOP
ENDIF
//put the first stoploss
IF ONMARKET AND SPLOSS = 0 THEN
SET STOP pTRAILING TRSTART
ENDIF
//within reach of the take profit
IF Close-TRADEPRICE(1)>(TKPROFIT*0.9) AND CountOfPosition < 3 AND LONGONMARKET THEN
BUY 1 PERPOINT AT MARKET
ENDIF
IF TRADEPRICE(1)-Close>(TKPROFIT*0.9) AND CountOfPosition < 3 AND SHORTONMARKET THEN
SELLSHORT 1 PERPOINT AT MARKET
ENDIF
Newbie type Questions & Answers
This topic contains 45 replies,
has 5 voices, and was last updated by tradetrader101
5 years, 9 months ago.
| Forum: | ProOrder: Automated Strategies & Backtesting |
| Language: | English |
| Started: | 04/09/2020 |
| Status: | Active |
| Attachments: | 6 files |
The information collected on this form is stored in a computer file by ProRealCode to create and access your ProRealCode profile. This data is kept in a secure database for the duration of the member's membership. They will be kept as long as you use our services and will be automatically deleted after 3 years of inactivity. Your personal data is used to create your private profile on ProRealCode. This data is maintained by SAS ProRealCode, 407 rue Freycinet, 59151 Arleux, France. If you subscribe to our newsletters, your email address is provided to our service provider "MailChimp" located in the United States, with whom we have signed a confidentiality agreement. This company is also compliant with the EU/Swiss Privacy Shield, and the GDPR. For any request for correction or deletion concerning your data, you can directly contact the ProRealCode team by email at privacy@prorealcode.com If you would like to lodge a complaint regarding the use of your personal data, you can contact your data protection supervisory authority.