| Coding Forum Collaborate, receive help, or discuss coding related issues. |
![]() | | Tweet | |
| | #9 | ||
![]() | Re: EasyLanguage Help Needed MarketPosition(1)
__________________ Precise, "dialed-in", targeted combination setups, like opening a combination lock; is the experience you should be having while trading. Dial left, right, left, . . . click - the lock opens. | ||
| |
|
| | #10 | ||
![]() | Re: EasyLanguage Help Needed | ||
| |
|
| | #11 | ||
![]() | Re: EasyLanguage Help Needed Quote:
![]() Unfortunately this isn’t the problem because it doesn’t opens other positions even if the price go my way and reach the entry price+X points leve and goes even much further... Quote:
I just wanted to buy X points over the last entry so “entry price(1)” would be perfect! So I changed the code this way: Code: If marketposition = 0 and ConditionLong Then Buy next bar At High + 1 point stop; If marketposition > 0 then buy next bar at Entryprice(1) + X points stop; Unfortunately the problem still persisted and the TS opened just the first position. Then I tried to experiment another way: I changed the pyramid filter from a constant number of points (X) to a fraction of the ATR: Code: var1 = AvgTrueRange( ATRLength ) * NumATRs; If marketposition = 0 and ConditionLong Then Buy next bar At High + 1 point stop; If marketposition > 0 then buy next bar at Entryprice(1) + var1 stop; ![]() But not the way I was looking for, because it opens positions even if the price goes down till the exit condition is met. ![]() I want it to pyramid adding positions only if the price goes in the right direction…precisely every X ATR (or X points) from the last entry price... | ||
| |
|
| | #12 | ||
![]() | Re: EasyLanguage Help Needed Code: var: x(0), mp(0), cs(0), np(0), step(2);
mp=marketposition;
cs=currentshares;
np=entryprice+cs*step;
if mp=0 and d=1111102 then buy next bar market;
if mp>0 then buy next bar np stop;
if cs<>cs[1] then begin
x=text_new(d,t,np,"next="+numtostr(np,2)); text_setstyle(x,1,2);
end; | ||
| |
|
| | #13 | ||
![]() | Re: EasyLanguage Help Needed Quote:
Hi onesmith, and thank you for the reply! ![]() As I said in the first post I’m still a newbie in programming and, honestly, I’m not yet so skilled to understand totally the code you posted. ![]() Anyway I tried it but again it wasn’t doing what I’m looking for I write here the full code of this (“simple once coded”) trading system: Code: Inputs: Price(Close), LenA(10), LenB(100), ATRLength(20), NumATRs(1) ; var: mp(0), var0(0), var1(0), var2(0); mp=marketposition*currentshares; var0 = Average(Price, LenA); var1 = Average(Price, LenB); var2 = AvgTrueRange( ATRLength ) * NumATRs; Condition1 = var0>var1; Condition2 = var0<var1; If mp = 0 and Condition1 Then Buy next bar At High + var2 stop; If mp > mp[1] then buy next bar at entryprice + var2 stop; If mp > 0 and Condition2 Then sell next bar at market; How people can code this? | ||
| |
|
| | #14 | ||
![]() | Re: EasyLanguage Help Needed // PreviousPrice stores most recent EntryPrice. // if mp=0 then NextPrice is CrossPrice+atr. // if mp=1 then NextPrice is PreviousPrice+atr. Code: var: fast(0), slow(0), atr(0), cs(0), crossPrice(0), previousPrice(0), nextPrice(0);
fast=average(c,10);
slow=average(c,100);
atr=AvgTrueRange(20);
cs=currentshares;
if fast>slow then begin
if fast crosses above slow then begin
crossPrice=H; nextPrice=crossPrice+atr;
end;
if cs>0 then begin
if cs>cs[1] then previousPrice=maxlist(open,nextPrice);
nextPrice=previousPrice+atr;
end else nextPrice=crossPrice+atr;
if crossPrice>0 then buy next bar nextPrice stop;
end else sell next bar market; | ||
| |
|
| The Following User Says Thank You to onesmith For This Useful Post: | ||
LiukK (12-03-2011) | ||
| | #15 | ||
![]() | Re: EasyLanguage Help Needed Quote:
the TS works perfectly now ![]() there are so many things I still don't know and your help have been really invaluable | ||
| |
|
![]() |
| Thread Tools | |
| Display Modes | Help Others By Rating This Thread |
| |
| ∧ Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What else is Needed to Get It Right? | bharatk8 | Tools of the Trade | 0 | 04-10-2011 06:55 PM |
| EL Help Needed | swakpixel | Coding Forum | 6 | 05-01-2010 06:28 AM |
| Jurik Easylanguage Functions Needed | simterann22 | Coding Forum | 2 | 08-20-2009 12:01 PM |
| just what i needed | xztheericzx | Beginners Forum | 0 | 11-04-2007 05:21 AM |