Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, dr_panther, 2 invisible), 1,056 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
pending orders #410708
11/07/12 13:26
11/07/12 13:26
Joined: Nov 2012
Posts: 19
Texas, US
D
deweymcg Offline OP
Newbie
deweymcg  Offline OP
Newbie
D

Joined: Nov 2012
Posts: 19
Texas, US
Please forgive the newbie question but I am new to coding. I am trying to write a script where when certain conditions are met a pending buy or sell order is placed when price hits the value of tema. The pseudocode would be:

If (condition) then

Buy (MoneyManagement computed) lots at TEMA( 74 )[1]; (and the reverse for a sell order).


I know you can call a function inside an enterLong() command, but I can't figure out how to do this.

Re: pending orders [Re: deweymcg] #410709
11/07/12 14:11
11/07/12 14:11
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
The function inside enterlong is for trade exit only, not (yet) for trade entry. For entering, just check if the price hits TEMA and then place a market order.

Re: pending orders [Re: jcl] #410731
11/07/12 18:54
11/07/12 18:54
Joined: Nov 2012
Posts: 19
Texas, US
D
deweymcg Offline OP
Newbie
deweymcg  Offline OP
Newbie
D

Joined: Nov 2012
Posts: 19
Texas, US
I wanted it to place a pending order for the value of TEMA at the time the first condition is met. TEMA would be at a different value if we wait until price converges with TEMA. is there a way to do that?

Re: pending orders [Re: deweymcg] #410775
11/08/12 16:50
11/08/12 16:50
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Sure, enter at market when the price crosses the TEMA _and_ the first condition was met within the last n bars.

Re: pending orders [Re: deweymcg] #410779
11/08/12 17:58
11/08/12 17:58
Joined: Sep 2012
Posts: 74
Niedersachsen, Germany
P
PriNova Offline
Junior Member
PriNova  Offline
Junior Member
P

Joined: Sep 2012
Posts: 74
Niedersachsen, Germany
Originally Posted By: deweymcg
I wanted it to place a pending order for the value of TEMA at the time the first condition is met. TEMA would be at a different value if we wait until price converges with TEMA. is there a way to do that?


if i understand you right, you would place a pending order at the actual price of TEMA, when conditions meet.
i suggest you store the price of TEMA in a variable at the given condition and check if price of market hit this value and open then a market order.
Then it doesn't matter if TEMA changes after x-bars, because you captured the price of TEMA at your defined conditions.

pseudocode:
Code:
if(condition1 == true)
{
   var TEMAvalue = TEMA(...);
}
if(priceClose() == TEMAvalue)
{
   enterTrade();
}


Last edited by PriNova; 11/08/12 18:01.
Re: pending orders [Re: PriNova] #410781
11/08/12 19:12
11/08/12 19:12
Joined: Nov 2012
Posts: 19
Texas, US
D
deweymcg Offline OP
Newbie
deweymcg  Offline OP
Newbie
D

Joined: Nov 2012
Posts: 19
Texas, US
Thanks! That looks like it will do the trick. I will test this when I get back home


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1