Basic coding question
Forums › ProRealTime English forum › ProOrder support › Basic coding question
- This topic has 30 replies, 3 voices, and was last updated 7 years ago by BC.
-
-
05/25/2017 at 3:05 PM #36635
I am stucking on a basic coding…how to code below?
Buy 1 contract after Bullcondition appear BullCandleStyle.
Thanks
Bin
123456789101112//Buy conditionBullcondition=low crosses over Average[20](close)//Candle styleBC1 = Close[1] < Close[2]BC2 = Close > Close[1]BullCandleStyle=BC1 and BC2//Long EntryIF after Bullcondition appear BullCandleStyle thenBUY 1 CONTRACT AT marketEndif05/25/2017 at 6:54 PM #3664805/25/2017 at 11:19 PM #3666605/26/2017 at 12:03 AM #3666705/26/2017 at 7:45 AM #36674How long you want to hold the condition? Couldn’t be forever as BullCondition may not be valid, so maybe you need below?
You can optimise variable x
1234567IF Bullcondition ThenBarIndex = BullIndexEndifIf BullCandleStyle and ((BarIndex - BullIndex) < x) ThenBUY 1 CONTRACT AT MarketEndifAs your Bull Condition is …
1Bullcondition=low crosses over Average[20](close)why not just use …
1Bullcondition = Low > Average[20](close)Then you could have …
123If BullCondition and BullCancdle ThemBuye 1 Share at MarketEndif05/26/2017 at 11:42 AM #36706Thanks Grahal, actually the bull condition contain 3MA and need confirm by a candle pull back.
I found this intersting strategy from internet and seem workable, you can take a look via below link.
http://www.tradingstrategyguides.com/big-three-trading-strategy/
05/26/2017 at 12:54 PM #36708Yeah link looks good, easy to read and well laid out website … I’ll digest better with my tea tonight. 🙂 It looks a lot like the Alligator Strategy?
I felt the simplistic explanation of the Alligator a bit naff when I first studied it, but I’m pleased to say it has stuck with me and I guess that is the reason (naff)! 🙂
https://www.forextraders.com/forex-education/forex-indicators/alligator-indicator-explained/
There is an Indicator on here …
https://www.prorealcode.com/prorealtime-indicators/bill-williams-alligator/
There is also the PRT Default … see attached.
GraHal
05/27/2017 at 3:15 PM #3677805/27/2017 at 3:28 PM #3677905/27/2017 at 4:04 PM #3678305/27/2017 at 5:53 PM #36797Hi GraHal
Here u go.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950defparam preloadbars = 3000defparam cumulateorders =false //true //false//Big Three MAFMA=Average[20](close) //green coloured(0,255,0)MMA=Average[40](close)//blue coloured(0,0,255)SMA=Average[80](close)//red coloured(255,0,0)//High Low Bar SettingCP=10//Long Entryif BC and BCandle then//BUY min(25,PositionSizeLong) CONTRACT AT MARKETBUY 1 CONTRACT AT MARKETStopLossLong=Tradeprice-SMA[1]//takeProfit = takeProfitLongendif//Long Exitif LongonMarket and close crosses under SMA thensell at marketendif//short entryif SC and SCandle then//SELLSHORT min(25,PositionSizeShort) CONTRACT AT MARKETSELLSHORT 1 CONTRACT AT MARKETStopLossShort=SMA[1]-Tradeprice//takeProfit = takeProfitShortendif//Short Exitif ShortonMarket and close crosses over SMA thenexitshort at marketendif// Stop Lossif LongonMarket thenSET STOP LOSS StopLossLongendifif ShortonMarket thenSET STOP LOSS StopLossShortendifgraph SMAgraph Tradepricegraph StopLossLonggraph StopLossShort05/27/2017 at 5:56 PM #36798miss condition
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475defparam preloadbars = 3000defparam cumulateorders =false //true //false//Big Three MAFMA=Average[20](close) //green coloured(0,255,0)MMA=Average[40](close)//blue coloured(0,0,255)SMA=Average[80](close)//red coloured(255,0,0)//High Low Bar SettingCP=10//Buy SignalB1=low > SMA and low>MMA and low>FMAB2=high >= highest[CP](high)BC=B1 and B2//Buy CandleBC1 = Close[1] < Close[2]BC2 = Close > Close[1]BC3 = Close > OpenBCandle = BC1 and BC2 and BC3//Sell SignalS1=high < FMA and high<MMA and high<SMAS2=low <= lowest[CP](low)SC=S1 and S2//Sell CaandleSC1 = Close[1] > Close[2]SC2 = Close < Close[1]SC3 = Close < OpenSCandle = SC1 and SC2 and SC3//Long Entryif BC and BCandle then//BUY min(25,PositionSizeLong) CONTRACT AT MARKETBUY 1 CONTRACT AT MARKETStopLossLong=Tradeprice-SMA[1]//takeProfit = takeProfitLongendif//Long Exitif LongonMarket and close crosses under SMA thensell at marketendif//short entryif SC and SCandle then//SELLSHORT min(25,PositionSizeShort) CONTRACT AT MARKETSELLSHORT 1 CONTRACT AT MARKETStopLossShort=SMA[1]-Tradeprice//takeProfit = takeProfitShortendif//Short Exitif ShortonMarket and close crosses over SMA thenexitshort at marketendif// Stop Lossif LongonMarket thenSET STOP LOSS StopLossLongendifif ShortonMarket thenSET STOP LOSS StopLossShortendifgraph SMAgraph Tradepricegraph StopLossLonggraph StopLossShort05/27/2017 at 7:43 PM #3680105/27/2017 at 8:10 PM #3680205/28/2017 at 3:46 AM #36815 -
AuthorPosts
Find exclusive trading pro-tools on