when the SUM of 2 stock price is less than 430, i want to place order for both stock, else continue scanning.
but i am having trouble putting it in code.

Code button (use to enter/paste AFL formula)op1 = "ITC.NSE";
op2 = "NTPC.NSE";
priceNow = "opt1" + "opt2";
for( priceNow > "430"; priceNow < "430"; priceNow++ )
  if( priceNow <="430" )
    PlaceOrder("f90058ca-9beb-4681-9a89-xxxxxx1", "ITC.NSE", "b", "simple", "m", "d", "IOC", 1, 0, 0, 0, 0, 0, 0);
	PlaceOrder("f90058ca-9beb-4681-9a89-xxxxxxx", "NTPC.NSE", "b", "simple", "m", "d", "IOC", 1, 0, 0, 0, 0, 0, 0);
check again

Welcome to the forum.

Unfortunately, your explanation and the code sample dont seem sufficient to explain what you are doing and in which context like Indicator / Exploration etc.
Also, the syntax of AFL is not correct and what is the reason for using a FOR loop ?

There are number of mistakes in your formula. First you are using strings instead of numbers here:

for( priceNow > "430"; priceNow < "430"; priceNow++ ) 
// incorrect: should use numbers

"430" is a string. You likely wanted a number. Still

for( priceNow > 430; priceNow < 430; priceNow++ ) 
// incorrect initial value not set

is incorrect because priceNow > 430 is a comparison, not assignment. You should assign initial value to loop variable like this

for( priceNow = 430; priceNow < 430; priceNow++ ) 
// incorrect: ending condition never met

But then again the code is doing nothing because priceNow < 430 (continuation condition) is never met in your code.

You need to learn a whole lot more about for syntax

And more generic:https://www.programiz.com/c-programming/c-for-loop


Tomas & Travick, thanks for the reply.
i agree my code has errors & i have a long way to go.

all i want to do is generate strangle order signal when the price comes to a certain level.

SZX2200CALL is @ 12$
SZX2000PUT is @ 15$
-------------Total is @ 27$ Now
--------I want to Buy
--when the Total is @ 20$ at some point in future.

for this i am trying to figure out the way to scan & generate alert & Buy signal.

Any help is appreciated.