ICHIMOKU code problems
Forums › ProRealTime English forum › ProOrder support › ICHIMOKU code problems
- This topic has 2 replies, 2 voices, and was last updated 6 years ago by
Nicolas.
-
-
07/22/2019 at 4:34 PM #102872
Sorry to be posting this here but cannot access the community forum.
When preparing for trading the issue with defined variables stops me from trading. The variables are defined as you can see from the attachment.
The following, is the code I want to use. Could someone please help me to sort out the undefined variable conflict? It would help if proRealTime highlighted the error in the code. I have defined all the variables within any [ ] brackets.
/LINK https://www.prorealcode.com/prorealtime-trading-strategies/ichimoku-exits-cloud/
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110//Source idea: https://www.whselfinvest.nl/nl-nl/trading-platform/gratis-trading-strategie/tradingsysteem/17-ichimoku-tkcDefparam CumulateOrders = false // Cumulating positions deactivated//Defparam flatafter = 164500//once StartE = 080000 //start time for opening positions//once StartL = 160000 //ending time for opening positions (only trading in the morning)once N = 2 // intitial number of contractsOTD = Barindex - TradeIndex(5) > IntradayBarIndex // limits the (opening) trades till 1 per dayonce Spread = 6 //total spread buy and sell, the actual price is always in between !once SL = round(close * 100/10000) //Setting Stop loss //Dynamic for indices// Ichimoku settingsTenkanSen = (highest[S](high)+lowest[S](low))/2 // default setting S = 9KijunSen = (highest[M](high)+lowest[M](low))/2 // default setting M = 26SenkouSpanA = (Tenkansen[M]+Kijunsen[M])/2 // default setting M = 26SenkouSpanB = (highest[L](High[M])+lowest[L](Low[M]))/2 //default setting L = 52// Closing methodes (described for long positions, for short positions exactly the opposite//Method 1 if TenkanSen crosses under the Kijunsen//Method 2 if close closes under the upper side of the Kumo / Cloud, based upon the SenkouSpanA//Method 3 if close closes under the lower side of the Kumo / Cloud, based upon the SenkouSpanBClosingMethod = cm //default is cm = 1//Open LONG BUY conditions (2):// 1: Tenkan Sen crosses over the Kijun Sen AND// 2: Close is within 4 periods after the crossing above the Kumo (cloud), defined as Max(SenkouSpanA, SenkouSpanB) ///Open SHORT SELL conditions (2):// 1: Tenkan Sen crosses under the Kijun Sen AND// 2: Close is within 4 periods after the crossing BELOW the Kumo (cloud), defined as Min(SenkouSpanA, SenkouSpanB) /KumoBorderLong = Max(SenkouSpanA, SenkouSpanB) //KumoBorderShort = Min(SenkouSpanA, SenkouSpanB) ////graph KumoBorderShortIf TenkanSen crosses over KijunSen then // base for counting bars when crossing takes placeCondLong = 1elseCondLong = 0endifIf TenkanSen crosses under KijunSen thenCondShort = 1elseCondShort = 0endif//graph cond1Lif OTD and not onmarket thenIF summation[4](CondLong) = 1 and summation[4](CondShort) = 0 and Close > KumoBorderLong then //BUY N shares AT MARKETSET STOP ploss SLendifIF summation[4](CondLong) = 0 and summation[4](CondShort) = 1 and Close < KumoBorderShort THEN //SELLSHORT N shares AT MARKET //short sell conditieSET STOP pLOSS SLendifendif // end purchase conditionsif not onmarket thenPriceExit = 0endifif longonmarket then // 3 Exit strategiesif ClosingMethod = 1 thenIf TenkanSen crosses under KijunSen thensell at marketendifendifif ClosingMethod = 2 thenif close - Spread * 0.5 < KumoBorderShort then //to secure a possible stop for Sell at marketPriceExit = close - Spread * 0.5elsePriceExit = KumoBorderShort // regular STOP for sell at market, set for each trading barendifendifif ClosingMethod = 3 thenif close - Spread * 0.5 < KumoBorderLong then //to secure a possible stop for Sell at marketPriceExit = close - Spread * 0.5elsePriceExit = KumoBorderShort // regular STOP for sell at market, set for each trading barendifendifendifif shortonmarket then //// 3 Exit strategiesif ClosingMethod = 1 thenIf TenkanSen crosses over KijunSen thenexitshort at marketendifendifif ClosingMethod = 2 thenif close + Spread * 0.5 > KumoBorderLong then //to secure a possible stop for Sell at marketPriceExit = close + Spread * 0.5elsePriceExit = KumoBorderLong // regular STOP for EXIT SHORT at market, set for each trading barendifendifif ClosingMethod = 3 thenif close + Spread * 0.5 > KumoBorderShort then //to secure a possible stop for Sell at marketPriceExit = close + Spread * 0.5elsePriceExit = KumoBorderShort // regular STOP for EXIT SHORT at market, set for each trading barendifendifendif//exit on trailing stop price levelsif onmarket and priceexit>0 then //price exit set for each trading barEXITSHORT AT priceexit STOPSELL AT priceexit STOPendif//graph priceexit07/22/2019 at 4:59 PM #103130Undefined variables means that they are not present in the code (or commented with either a double slash // or with REM instruction). So remove the double slash and REM from the code in order to get the variables to be defined.
Another way is to download the file in the library and import it into the platform instead of copy/pasting it. -
AuthorPosts
